incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1230352 - in /incubator/tashi/trunk/src/tashi: clustermanager/clustermanagerservice.py nodemanager/nodemanagerservice.py nodemanager/vmcontrol/qemu.py
Date Thu, 12 Jan 2012 01:41:15 GMT
Author: stroucki
Date: Thu Jan 12 01:41:14 2012
New Revision: 1230352

URL: http://svn.apache.org/viewvc?rev=1230352&view=rev
Log:
qemu: don't alter state during matching pids for now. rely on stored information
      use shlex command line splitting to deal with quoted arguments
      add success flag to be able to tell whether a migration was successful
nodemanagerservice: fix thread target name. don't know why pyflakes didn't detect this.
clustermanagerservice: don't refresh remote state on non-running VMs

Tested working: pause, unpause, suspend, resume, shutdown

Modified:
    incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
    incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
    incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py

Modified: incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py?rev=1230352&r1=1230351&r2=1230352&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py Thu Jan 12 01:41:14
2012
@@ -269,6 +269,12 @@ 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:
+				continue
+
 			if (self.instanceLastContactTime[instanceId] < (self.__now() - self.allowDecayed)):
 				try:
 					instance = self.data.acquireInstance(instanceId)

Modified: incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py?rev=1230352&r1=1230351&r2=1230352&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py Thu Jan 12 01:41:14
2012
@@ -311,7 +311,7 @@ class NodeManagerService(object):
 		try:
 			instance.vmId = self.vmm.resumeVm(instance, name)
 			self.instances[instance.vmId] = instance
-			threading.Thread(target=self.resumeVmHelper, args=(instance, name)).start()
+			threading.Thread(target=self.__resumeVmHelper, args=(instance, name)).start()
 		except:
 			self.log.exception('resumeVm failed')
 			raise TashiException(d={'errno':Errors.UnableToResume,'msg':"resumeVm failed on the node
manager"})

Modified: incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py?rev=1230352&r1=1230351&r2=1230352&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py Thu Jan 12 01:41:14 2012
@@ -26,6 +26,7 @@ import socket
 import subprocess
 import sys
 import time
+import shlex
 
 #from tashi.rpycservices.rpyctypes import *
 from tashi.rpycservices.rpyctypes import InstanceState, Host
@@ -218,9 +219,11 @@ class Qemu(VmControlInterface):
 				# VM is still running
 				try:
 					if (child.migratingOut):
-						self.nm.vmStateChange(vmId, None, InstanceState.MigrateTrans)
+						#self.nm.vmStateChange(vmId, None, InstanceState.MigrateTrans)
+						pass
 					else:
-						self.nm.vmStateChange(vmId, None, InstanceState.Running)
+						#self.nm.vmStateChange(vmId, None, InstanceState.Running)
+						pass
 				except:
 					log.exception("vmStateChange failed for VM %s" % (name))
 						
@@ -508,8 +511,9 @@ class Qemu(VmControlInterface):
 		#  Construct the qemu command
 		strCmd = "%s %s %s -clock %s %s %s -m %d -smp %d -serial null -vnc none -monitor pty" %
(self.QEMU_BIN, noAcpiString, cpuString, clockString, diskString, nicString, instance.memory,
instance.cores)
 		if (source):
-			strCmd = "%s -incoming %s" % (strCmd, source)
-		cmd = strCmd.split()
+			strCmd = '%s -incoming "%s"' % (strCmd, source)
+		# XXXstroucki perhaps we're doing it backwards
+		cmd = shlex.split(strCmd)
 
 		log.info("Executing command: %s" % (strCmd))
 		(pipe_r, pipe_w) = os.pipe()
@@ -587,14 +591,16 @@ class Qemu(VmControlInterface):
 				# trying to restart the migration by running
 				# the command again (when qemu is ready to
 				# listen again) is probably not helpful
+				success = False
 				res = self.__enterCommand(child, "migrate -i %s" % (target), timeout=self.migrateTimeout)
 				retry = retry - 1
 				if (res.find("migration failed") == -1):
+					success = True
 					retry = 0
 					break
 				else:
 					log.error("Migration (transiently) failed: %s\n", res)
-			if (retry == 0):
+			if (retry == 0) and (success is False):
 				log.error("Migration failed: %s\n", res)
 				child.errorBit = True
 				raise RuntimeError



Mime
View raw message