incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1245858 - in /incubator/tashi/branches/stroucki-irpbugs/src/tashi: client/tashi-client.py clustermanager/clustermanagerservice.py clustermanager/data/pickled.py nodemanager/vmcontrol/qemu.py
Date Sat, 18 Feb 2012 03:50:31 GMT
Author: stroucki
Date: Sat Feb 18 03:50:31 2012
New Revision: 1245858

URL: http://svn.apache.org/viewvc?rev=1245858&view=rev
Log:
tashi-client: Apply r1245045
pickled: use items and not itervalues to guard against underlying dict changing
clustermanagerservice: Instance needs to be obtained first
qemu.py: Apply r1236442

Modified:
    incubator/tashi/branches/stroucki-irpbugs/src/tashi/client/tashi-client.py
    incubator/tashi/branches/stroucki-irpbugs/src/tashi/clustermanager/clustermanagerservice.py
    incubator/tashi/branches/stroucki-irpbugs/src/tashi/clustermanager/data/pickled.py
    incubator/tashi/branches/stroucki-irpbugs/src/tashi/nodemanager/vmcontrol/qemu.py

Modified: incubator/tashi/branches/stroucki-irpbugs/src/tashi/client/tashi-client.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-irpbugs/src/tashi/client/tashi-client.py?rev=1245858&r1=1245857&r2=1245858&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-irpbugs/src/tashi/client/tashi-client.py (original)
+++ incubator/tashi/branches/stroucki-irpbugs/src/tashi/client/tashi-client.py Sat Feb 18
03:50:31 2012
@@ -166,7 +166,7 @@ def getSlots(cores, memory):
 			continue
 		countbycores = int((h.cores - h.usedCores) / cores)
 		countbymemory = int((h.memory - h.usedMemory) / memory)
-		count += min(countbycores, countbymemory)
+		count += max(0, min(countbycores, countbymemory))
 
 	print "%d" % (count),
 	print (lambda:"instances", lambda:"instance")[count == 1](),

Modified: incubator/tashi/branches/stroucki-irpbugs/src/tashi/clustermanager/clustermanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-irpbugs/src/tashi/clustermanager/clustermanagerservice.py?rev=1245858&r1=1245857&r2=1245858&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-irpbugs/src/tashi/clustermanager/clustermanagerservice.py
(original)
+++ incubator/tashi/branches/stroucki-irpbugs/src/tashi/clustermanager/clustermanagerservice.py
Sat Feb 18 03:50:31 2012
@@ -269,18 +269,19 @@ class ClusterManagerService(object):
 		
 		# iterate through all VMs I believe are active
 		for instanceId in self.instanceLastContactTime.keys():
-			# Don't query non-running VMs. eg. if a VM
-			# is suspended, and has no host, then there's
-			# no one to ask
-			if instance.state != InstanceState.Running and \
-			   instance.state != InstanceState.Activating and \
-			   instance.state != InstanceState.Orphaned:
-				continue
 
 			# XXXstroucki should lock instance here?
 			if (self.instanceLastContactTime[instanceId] < (self.__now() - self.allowDecayed)):
 				try:
 					instance = self.data.acquireInstance(instanceId)
+					# Don't query non-running VMs. eg. if a VM
+					# is suspended, and has no host, then there's
+					# no one to ask
+					if instance.state != InstanceState.Running and \
+					   instance.state != InstanceState.Activating and \
+					   instance.state != InstanceState.Orphaned:
+						self.data.releaseInstance(instanceId)
+						continue
 				except:
 					continue
 

Modified: incubator/tashi/branches/stroucki-irpbugs/src/tashi/clustermanager/data/pickled.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-irpbugs/src/tashi/clustermanager/data/pickled.py?rev=1245858&r1=1245857&r2=1245858&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-irpbugs/src/tashi/clustermanager/data/pickled.py (original)
+++ incubator/tashi/branches/stroucki-irpbugs/src/tashi/clustermanager/data/pickled.py Sat
Feb 18 03:50:31 2012
@@ -39,14 +39,14 @@ class Pickled(FromConfig):
 	
 	def cleanInstances(self):
 		ci = {}
-		for i in self.instances.itervalues():
+		for ignore, i in self.instances.items():
 			i2 = Instance(d=i.__dict__)
 			ci[i2.id] = i2
 		return ci
 	
 	def cleanHosts(self):
 		ch = {}
-		for h in self.hosts.itervalues():
+		for ignore, h in self.hosts.items():
 			h2 = Host(d=h.__dict__)
 			ch[h2.id] = h2
 		return ch
@@ -67,11 +67,11 @@ class Pickled(FromConfig):
 		self.instances = instances
 		self.networks = networks
 		self.users = users
-		for i in self.instances.itervalues():
+		for ignore, i in self.instances.items():
 			if (i.id >= self.maxInstanceId):
 				self.maxInstanceId = i.id + 1
 			i._lock = threading.Lock()
 			self.lockNames[i._lock] = "i%d" % (i.id)
-		for h in self.hosts.itervalues():
+		for ignore, h in self.hosts.items():
 			h._lock = threading.Lock()
 			self.lockNames[h._lock] = "h%d" % (h.id)

Modified: incubator/tashi/branches/stroucki-irpbugs/src/tashi/nodemanager/vmcontrol/qemu.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-irpbugs/src/tashi/nodemanager/vmcontrol/qemu.py?rev=1245858&r1=1245857&r2=1245858&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-irpbugs/src/tashi/nodemanager/vmcontrol/qemu.py (original)
+++ incubator/tashi/branches/stroucki-irpbugs/src/tashi/nodemanager/vmcontrol/qemu.py Sat
Feb 18 03:50:31 2012
@@ -206,9 +206,8 @@ class Qemu(VmControlInterface):
 					if self.scratchVg is not None:
 						log.info("Removing any scratch for %s" % (name))
 						cmd = "/sbin/lvremove --quiet -f %s" % self.scratchVg
-    						result = subprocess.Popen(cmd.split(), executable=cmd.split()[0], stdout=subprocess.PIPE,
stderr=open(os.devnull, "w"), close_fds=True).wait()
+    						result = subprocess.Popen(cmd.split(), executable=cmd.split()[0], stdout=subprocess.PIPE,
stderr=os.open(os.devnull, "w"), close_fds=True).wait()
 				except:
-					log.warning("Problem cleaning scratch volumes")
 					pass
 
 				# let the NM know



Mime
View raw message