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 st...@apache.org on 2012/01/06 20:52:32 UTC

svn commit: r1228394 - in /incubator/tashi/branches/stroucki-accounting/src/tashi: clustermanager/clustermanagerservice.py nodemanager/nodemanagerservice.py nodemanager/vmcontrol/qemu.py

Author: stroucki
Date: Fri Jan  6 20:52:32 2012
New Revision: 1228394

URL: http://svn.apache.org/viewvc?rev=1228394&view=rev
Log:
qemu.py: bug fix, add newly created instance to NM state
nodemanagerservice: add fn to define instance created by VMM, use builtin toStrings of Host and Instance.
clustermanagerservice: remove raise, just log exception


Modified:
    incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py
    incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/nodemanagerservice.py
    incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/vmcontrol/qemu.py

Modified: incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py?rev=1228394&r1=1228393&r2=1228394&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py Fri Jan  6 20:52:32 2012
@@ -103,7 +103,6 @@ class ClusterManagerService(object):
 				instanceText = 'Instance(id %d host %d vmId %d user %d cores %d memory %d)' % (instance.id, instance.hostId, instance.vmId, instance.userId, instance.cores, instance.memory)
 			except:
 				self.log.exception("Invalid instance data")
-				raise
 
 		if host is not None:
 			try:

Modified: incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/nodemanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/nodemanagerservice.py?rev=1228394&r1=1228393&r2=1228394&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/nodemanagerservice.py (original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/nodemanagerservice.py Fri Jan  6 20:52:32 2012
@@ -138,10 +138,16 @@ class NodeManagerService(object):
                 hostText = None
 
                 if instance is not None:
-                        instanceText = 'Instance(id %d host %d vmId %d user %d cores %d memory %d)' % (instance.id, instance.hostId, instance.vmId, instance.userId, instance.cores, instance.memory)
+			try:
+                        	instanceText = 'Instance(%s)' % (instance)
+			except:
+				self.log.exception("Invalid instance data")
 
                 if host is not None:
-                        hostText = "Host(id %d memory %d cores %d)" % (host.id, host.memory, host.cores)
+			try:
+                        	hostText = "Host(%s)" % (host)
+			except:
+				self.log.exception("Invalid host data")
 
                 secondary = ','.join(filter(None, (hostText, instanceText)))
 
@@ -246,15 +252,21 @@ class NodeManagerService(object):
 			return True
 
 		return True
+
+	# remote
+	def createInstance(self, instance):
+		vmId = instance.vmId
+		self.instances[vmId] = instance
+		
 	
 	# remote
 	def instantiateVm(self, instance):
 		self.__ACCOUNT("NM VM INSTANTIATE", instance=instance)
 		try:
 			vmId = self.vmm.instantiateVm(instance)
-			instance.vmId = vmId
-			instance.state = InstanceState.Running
-			self.instances[vmId] = instance
+			#instance.vmId = vmId
+			#instance.state = InstanceState.Running
+			#self.instances[vmId] = instance
 			return vmId
 		except:
 			self.log.exception("Failed to start instance")

Modified: incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/vmcontrol/qemu.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/vmcontrol/qemu.py?rev=1228394&r1=1228393&r2=1228394&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/vmcontrol/qemu.py (original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/vmcontrol/qemu.py Fri Jan  6 20:52:32 2012
@@ -394,11 +394,11 @@ class Qemu(VmControlInterface):
 		#  Capture __startVm Hints
 		#  CPU hints
 		cpuModel = instance.hints.get("cpumodel")
-		# clean off whitespace
-		cpuModel = self.__stripSpace(cpuModel)
 
 		cpuString = ""
 		if cpuModel:
+			# clean off whitespace
+			cpuModel = self.__stripSpace(cpuModel)
 			cpuString = "-cpu " + cpuModel 
 
 		#  Clock hints
@@ -616,6 +616,7 @@ class Qemu(VmControlInterface):
 			# otherwise on restart it will appear as Activating
 			# until we update the state in __matchSystemPids
 			child.instance.state = InstanceState.Running
+			self.nm.createInstance(child.instance)
 			self.nm.vmStateChange(vmId, None, InstanceState.Running)
 			self.__saveChildInfo(child)
 			return vmId