incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1231278 - in /incubator/tashi/trunk/src/tashi: clustermanager/clustermanagerservice.py dfs/vfs.py nodemanager/nodemanagerservice.py nodemanager/vmcontrol/qemu.py
Date Fri, 13 Jan 2012 19:55:53 GMT
Author: stroucki
Date: Fri Jan 13 19:55:53 2012
New Revision: 1231278

URL: http://svn.apache.org/viewvc?rev=1231278&view=rev
Log:
qemu.py: Orphaned and Activating states should be corrected by the NM, and not taken from
the CM. Unlink temporary state file after copying to DFS
nodemanagerservice.py: remove sleep in flush notify CM function
vfs.py: break out dfs to real translation into separate variable
clustermanagerservice.py: Check on instances with Running, Activating or Orphaned states


Modified:
    incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py
    incubator/tashi/trunk/src/tashi/dfs/vfs.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=1231278&r1=1231277&r2=1231278&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/clustermanagerservice.py Fri Jan 13 19:55:53
2012
@@ -272,7 +272,9 @@ class ClusterManagerService(object):
 			# 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:
+			if instance.state != InstanceState.Running and \
+			   instance.state != InstanceState.Activating and \
+			   instance.state != InstanceState.Orphaned:
 				continue
 
 			if (self.instanceLastContactTime[instanceId] < (self.__now() - self.allowDecayed)):

Modified: incubator/tashi/trunk/src/tashi/dfs/vfs.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/dfs/vfs.py?rev=1231278&r1=1231277&r2=1231278&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/dfs/vfs.py (original)
+++ incubator/tashi/trunk/src/tashi/dfs/vfs.py Fri Jan 13 19:55:53 2012
@@ -27,52 +27,67 @@ class Vfs(DfsInterface):
 		DfsInterface.__init__(self, config)
 		self.prefix = self.config.get("Vfs", "prefix")
 
-# why do these three need to be separate?	
+	def __dfsToReal(self, dfspath):
+		realpath = os.path.join(self.prefix, dfspath)
+		return realpath
+
 	def copyTo(self, localSrc, dst):
-		shutil.copy(localSrc, os.path.join(self.prefix, dst))
-# just assuming this works
+		realdest = self.__dfsToReal(dst)
+		shutil.copy(localSrc, realdest)
+		# just assuming this works
 		return None
 	
 	def copyFrom(self, src, localDst):
-		shutil.copy(os.path.join(self.prefix, src), localDst)
-# just assuming this works
+		realsrc = self.__dfsToReal(src)
+		shutil.copy(realsrc, localDst)
+		# just assuming this works
 		return None
 
 	def copy(self, src, dst):
-		shutil.copy(os.path.join(self.prefix, src),
-			    os.path.join(self.prefix, dst))
-# just assuming this works
+		realsrc = self.__dfsToReal(src)
+		realdst = self.__dfsToReal(dst)
+		shutil.copy(realsrc, realdst)
+		# just assuming this works
 		return None
 	
 	def list(self, path):
 		try:
-			return os.listdir(os.path.join(self.prefix, path))
+			realpath = self.__dfsToReal(path)
+			return os.listdir(realpath)
 		except OSError, e:
+			# XXXstroucki error 20 = ENOTDIR
 			if (e.errno == 20):
 				return [path.split('/')[-1]]
 			else:
 				raise
 	
 	def stat(self, path):
-		return os.stat(os.path.join(self.prefix, path))
+		realpath = self.__dfsToReal(path)
+		return os.stat(realpath)
 	
 	def move(self, src, dst):
-		shutil.move(os.path.join(self.prefix, src), 
-			    os.path.join(self.prefix, dst))
-# just assuming this works
+		realsrc = self.__dfsToReal(src)
+		realdst = self.__dfsToReal(dst)
+		shutil.move(realsrc, realdst)
+		# just assuming this works
 		return None
 	
 	def mkdir(self, path):
-		return os.mkdir(os.path.join(self.prefix, path))
+		realpath = self.__dfsToReal(path)
+		return os.mkdir(realpath)
 	
 	def unlink(self, path):
-		return os.unlink(os.path.join(self.prefix, path))
+		realpath = self.__dfsToReal(path)
+		return os.unlink(realpath)
 	
 	def rmdir(self, path):
-		return os.rmdir(os.path.join(self.prefix, path))
+		realpath = self.__dfsToReal(path)
+		return os.rmdir(realpath)
 	
 	def open(self, path, perm):
-		return open(os.path.join(self.prefix, path), perm)
+		realpath = self.__dfsToReal(path)
+		return open(realpath, perm)
 	
 	def getLocalHandle(self, path):
-		return os.path.join(self.prefix, path)
+		realpath = self.__dfsToReal(path)
+		return realpath

Modified: incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py?rev=1231278&r1=1231277&r2=1231278&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py Fri Jan 13 19:55:53
2012
@@ -132,9 +132,9 @@ class NodeManagerService(object):
 		except Exception, e:
 			self.log.exception('Failed to send data to the CM')
 
-		toSleep = start - time.time() + self.registerFrequency
-		if (toSleep > 0):
-			time.sleep(toSleep)
+		#toSleep = start - time.time() + self.registerFrequency
+		#if (toSleep > 0):
+			#time.sleep(toSleep)
 
         def __ACCOUNTFLUSH(self):
 		try:

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=1231278&r1=1231277&r2=1231278&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py Fri Jan 13 19:55:53 2012
@@ -154,7 +154,8 @@ class Qemu(VmControlInterface):
 
 		for vmId in vmIds:
 			child = controlledVMs[vmId]
-			name = child.instance.name
+			instance = child.instance
+			name = instance.name
 
 			if vmId not in pids:
 				# VM is no longer running, but is still
@@ -218,12 +219,12 @@ class Qemu(VmControlInterface):
 			else:
 				# VM is still running
 				try:
+					
 					if (child.migratingOut):
-						#self.nm.vmStateChange(vmId, None, InstanceState.MigrateTrans)
-						pass
-					else:
-						#self.nm.vmStateChange(vmId, None, InstanceState.Running)
-						pass
+						self.nm.vmStateChange(vmId, None, InstanceState.MigrateTrans)
+					elif (instance.state == InstanceState.Orphaned) or \
+						(instance.state == InstanceState.Activating):
+						self.nm.vmStateChange(vmId, None, InstanceState.Running)
 				except:
 					log.exception("vmStateChange failed for VM %s" % (name))
 						
@@ -634,6 +635,7 @@ class Qemu(VmControlInterface):
 		# XXX: Use fifo to improve performance
 		vmId = self.__stopVm(vmId, "\"exec:gzip -c > %s\"" % (tmpTarget), True)
 		self.dfs.copyTo(tmpTarget, target)
+		os.unlink(tmpTarget)
 		return vmId
 	
 	# extern



Mime
View raw message