You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tashi-commits@incubator.apache.org by mr...@apache.org on 2009/12/16 21:52:08 UTC

svn commit: r891441 - /incubator/tashi/trunk/src/tashi/agents/primitive.py

Author: mryan3
Date: Wed Dec 16 21:52:08 2009
New Revision: 891441

URL: http://svn.apache.org/viewvc?rev=891441&view=rev
Log:
Bug fixes around scheduling VMs in order, destroying pending VMs and muffling errors correctly


Modified:
    incubator/tashi/trunk/src/tashi/agents/primitive.py

Modified: incubator/tashi/trunk/src/tashi/agents/primitive.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/agents/primitive.py?rev=891441&r1=891440&r2=891441&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/agents/primitive.py (original)
+++ incubator/tashi/trunk/src/tashi/agents/primitive.py Wed Dec 16 21:52:08 2009
@@ -69,12 +69,13 @@
 						load[i.hostId] = load[i.hostId] + [i.id]
 				# Check for VMs that have exited
 				for i in oldInstances:
-					if (i not in instances):
+					if (i not in instances and oldInstances[i].state != InstanceState.Pending):
 						for hook in self.hooks:
 							hook.postDestroy(oldInstances[i])
 				# Schedule new VMs
 				oldInstances = instances
 				if (len(load.get(None, [])) > 0):
+					load[None].sort()
 					for i in load[None]:
 						inst = instances[i]
 						try:
@@ -116,7 +117,9 @@
 									self.log.info("Failed to find a suitable place to schedule %s" % (inst.name))
 									muffle[inst.name] = True
 						except Exception, e:
-							self.log.exception("Failed to schedule or activate %s" % (inst.name))
+							if (inst.name not in muffle):
+								self.log.exception("Failed to schedule or activate %s" % (inst.name))
+								muffle[inst.name] = True
 				time.sleep(self.scheduleDelay)
 			except TashiException, e:
 				self.log.exception("Tashi exception")