incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1226207 - in /incubator/tashi: branches/stablefix/src/tashi/clustermanager/ branches/stablefix/src/tashi/nodemanager/vmcontrol/ branches/stroucki-accounting/src/tashi/clustermanager/ branches/stroucki-accounting/src/tashi/nodemanager/ bran...
Date Sun, 01 Jan 2012 01:51:41 GMT
Author: stroucki
Date: Sun Jan  1 01:51:40 2012
New Revision: 1226207

URL: http://svn.apache.org/viewvc?rev=1226207&view=rev
Log:
xenpv: Address pyflakes issues
qemu: Address pyflakes issues
clustermanager: Address pyflakes issues
nodemanagerservice: Address pyflakes issues

"use strict" would be nice for python.

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

Modified: incubator/tashi/branches/stablefix/src/tashi/clustermanager/clustermanager.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stablefix/src/tashi/clustermanager/clustermanager.py?rev=1226207&r1=1226206&r2=1226207&view=diff
==============================================================================
--- incubator/tashi/branches/stablefix/src/tashi/clustermanager/clustermanager.py (original)
+++ incubator/tashi/branches/stablefix/src/tashi/clustermanager/clustermanager.py Sun Jan
 1 01:51:40 2012
@@ -32,6 +32,8 @@ from tashi.rpycservices import rpycservi
 from rpyc.utils.server import ThreadedServer
 from rpyc.utils.authenticators import TlsliteVdbAuthenticator
 
+log = None
+
 def startClusterManager(config):
 	global service, data
 	
@@ -64,6 +66,8 @@ def startClusterManager(config):
 
 @signalHandler(signal.SIGTERM)
 def handleSIGTERM(signalNumber, stackFrame):
+	global log
+
 	log.info('Exiting cluster manager after receiving a SIGINT signal')
 	sys.exit(0)
 	

Modified: incubator/tashi/branches/stablefix/src/tashi/nodemanager/vmcontrol/qemu.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stablefix/src/tashi/nodemanager/vmcontrol/qemu.py?rev=1226207&r1=1226206&r2=1226207&view=diff
==============================================================================
--- incubator/tashi/branches/stablefix/src/tashi/nodemanager/vmcontrol/qemu.py (original)
+++ incubator/tashi/branches/stablefix/src/tashi/nodemanager/vmcontrol/qemu.py Sun Jan  1
01:51:40 2012
@@ -539,7 +539,6 @@ class Qemu(VmControlInterface):
 		return vmId
 	
 	def suspendVm(self, vmId, target):
-		child = self.getChildFromPid(vmId)
 		tmpTarget = "/tmp/tashi_qemu_suspend_%d_%d" % (os.getpid(), vmId)
 		# XXX: Use fifo to improve performance
 		vmId = self.stopVm(vmId, "\"exec:gzip -c > %s\"" % (tmpTarget), True)
@@ -758,6 +757,7 @@ class Qemu(VmControlInterface):
 										self.stats[vmId]['%s_%s' % (device, label)] = int(val)
 					self.stats[vmId]['cpuLoad'] = cpuLoad
 					self.stats[vmId]['rss'] = rss
+					self.stats[vmId]['vsize'] = vsize
 					self.stats[vmId]['recvMBs'] = sendMBs
 					self.stats[vmId]['sendMBs'] = recvMBs
 			except:

Modified: incubator/tashi/branches/stablefix/src/tashi/nodemanager/vmcontrol/xenpv.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stablefix/src/tashi/nodemanager/vmcontrol/xenpv.py?rev=1226207&r1=1226206&r2=1226207&view=diff
==============================================================================
--- incubator/tashi/branches/stablefix/src/tashi/nodemanager/vmcontrol/xenpv.py (original)
+++ incubator/tashi/branches/stablefix/src/tashi/nodemanager/vmcontrol/xenpv.py Sun Jan  1
01:51:40 2012
@@ -111,6 +111,7 @@ class XenPV(VmControlInterface, threadin
 		self.transientDir = self.config.get('XenPV', 'transientDir')
 		self.defaultVmType = self.config.get('XenPV', 'defaultVmType') 
 		self.disktype = self.config.get('XenPV', 'defaultDiskType')
+		# XXXstroucki default disktype vhd?
 		self.newvms = listVms(self.vmNamePrefix)
 		self.hostId = -1
 		self.sleeptime = 5
@@ -133,7 +134,7 @@ class XenPV(VmControlInterface, threadin
 				# If the vm had transient disks, delete them
 				for i in range(len(a.disks)):
 					if a.disks[i].persistent == False:
-						diskname = self.transientDisk(a.id, i, disktype)
+						diskname = self.transientDisk(a.id, i, self.disktype)
 						try:
 							os.unlink(diskname)
 						except:
@@ -150,7 +151,7 @@ class XenPV(VmControlInterface, threadin
 			time.sleep(self.sleeptime)
 			self.cron()
 ########################################
-# This is an ugly function, but the muti-line string literal makes it
+# This is an ugly function, but the multi-line string literal makes it
 # a lot easier
 ########################################
 	def createXenConfig(self, vmName, 
@@ -167,12 +168,7 @@ class XenPV(VmControlInterface, threadin
 		vmType = hints.get('vmtype', self.defaultVmType)
 		print 'starting vm with type: ', vmType
 
-                try:
-                   disktype = self.config.get('XenPV', 'defaultDiskType')
-                except:
-                   disktype = 'vhd'
-
-                disk0 = 'tap:%s'%disktype
+                disk0 = 'tap:%s' % self.disktype
 		diskU = 'xvda1'
 
 		try:
@@ -216,7 +212,7 @@ kernel = "%s"
      ramdisk)
 
 		elif vmType == 'hvm':
-			disk0 = 'tap:%s'%disktype
+			disk0 = 'tap:%s' % self.disktype
 			diskU = 'hda1'
 
 

Modified: incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanager.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanager.py?rev=1226207&r1=1226206&r2=1226207&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanager.py
(original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanager.py
Sun Jan  1 01:51:40 2012
@@ -32,6 +32,8 @@ from tashi.rpycservices import rpycservi
 from rpyc.utils.server import ThreadedServer
 from rpyc.utils.authenticators import TlsliteVdbAuthenticator
 
+log = None
+
 def startClusterManager(config):
 	global service, data
 	
@@ -64,6 +66,8 @@ def startClusterManager(config):
 
 @signalHandler(signal.SIGTERM)
 def handleSIGTERM(signalNumber, stackFrame):
+	global log
+
 	log.info('Exiting cluster manager after receiving a SIGINT signal')
 	sys.exit(0)
 	

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=1226207&r1=1226206&r2=1226207&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/nodemanagerservice.py
(original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/nodemanagerservice.py
Sun Jan  1 01:51:40 2012
@@ -103,7 +103,7 @@ class NodeManagerService(object):
 						self.cm.vmUpdate(instanceId, newInst, old)
 					except TashiException, e:
 						notifyCM.append((instanceId, newInst, old, success))
-						if (e.errno != Erors.IncorrectVmState):
+						if (e.errno != Errors.IncorrectVmState):
 							raise
 					except:
 						notifyCM.append((instanceId, newInst, old, success))
@@ -327,6 +327,7 @@ class NodeManagerService(object):
 	# XXXstroucki migrate in?
 	def receiveVm(self, instance, transportCookie):
 		instance.state = InstanceState.MigrateTrans
+		vmId = instance.vmId
 		self.instances[vmId] = instance
 		self.__ACCOUNT("NM VM MIGRATE RECEIVE", instance=instance)
 		threading.Thread(target=self.__receiveVmHelper, args=(instance, transportCookie)).start()

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=1226207&r1=1226206&r2=1226207&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 Sun
Jan  1 01:51:40 2012
@@ -480,7 +480,7 @@ class Qemu(VmControlInterface):
 				if (self.useMigrateArgument):
 					thisDiskList.append("migrate=%s" % migrate)
 
-				diskstring = "%s-drive %s " % (diskString, ",".join(thisDiskList))
+				diskString = "%s-drive %s " % (diskString, ",".join(thisDiskList))
 
 		except:
 			log.exception('caught exception in scratch disk formation')
@@ -616,11 +616,10 @@ class Qemu(VmControlInterface):
 			return vmId
 		except:
 			log.exception("instantiateVm failed")
-			return None
+			raise
 	
 	# extern
 	def suspendVm(self, vmId, target):
-		child = self.__getChildFromPid(vmId)
 		tmpTarget = "/%s/tashi_qemu_suspend_%d_%d" % (self.scratchDir, os.getpid(), vmId)
 		# XXX: Use fifo to improve performance
 		vmId = self.__stopVm(vmId, "\"exec:gzip -c > %s\"" % (tmpTarget), True)
@@ -901,6 +900,7 @@ class Qemu(VmControlInterface):
 										self.stats[vmId]['%s_%s' % (device, label)] = int(val)
 					self.stats[vmId]['cpuLoad'] = cpuLoad
 					self.stats[vmId]['rss'] = rss
+					self.stats[vmId]['vsize'] = vsize
 					self.stats[vmId]['recvMBs'] = sendMBs
 					self.stats[vmId]['sendMBs'] = recvMBs
 			except:

Modified: incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/vmcontrol/xenpv.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/vmcontrol/xenpv.py?rev=1226207&r1=1226206&r2=1226207&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/vmcontrol/xenpv.py
(original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/nodemanager/vmcontrol/xenpv.py
Sun Jan  1 01:51:40 2012
@@ -111,6 +111,7 @@ class XenPV(VmControlInterface, threadin
 		self.transientDir = self.config.get('XenPV', 'transientDir')
 		self.defaultVmType = self.config.get('XenPV', 'defaultVmType') 
 		self.disktype = self.config.get('XenPV', 'defaultDiskType')
+		# XXXstroucki default disktype vhd?
 		self.newvms = listVms(self.vmNamePrefix)
 		self.hostId = -1
 		self.sleeptime = 5
@@ -133,7 +134,7 @@ class XenPV(VmControlInterface, threadin
 				# If the vm had transient disks, delete them
 				for i in range(len(a.disks)):
 					if a.disks[i].persistent == False:
-						diskname = self.transientDisk(a.id, i, disktype)
+						diskname = self.transientDisk(a.id, i, self.disktype)
 						try:
 							os.unlink(diskname)
 						except:
@@ -150,7 +151,7 @@ class XenPV(VmControlInterface, threadin
 			time.sleep(self.sleeptime)
 			self.cron()
 ########################################
-# This is an ugly function, but the muti-line string literal makes it
+# This is an ugly function, but the multi-line string literal makes it
 # a lot easier
 ########################################
 	def createXenConfig(self, vmName, 
@@ -167,12 +168,7 @@ class XenPV(VmControlInterface, threadin
 		vmType = hints.get('vmtype', self.defaultVmType)
 		print 'starting vm with type: ', vmType
 
-                try:
-                   disktype = self.config.get('XenPV', 'defaultDiskType')
-                except:
-                   disktype = 'vhd'
-
-                disk0 = 'tap:%s'%disktype
+                disk0 = 'tap:%s' % self.disktype
 		diskU = 'xvda1'
 
 		try:
@@ -216,7 +212,7 @@ kernel = "%s"
      ramdisk)
 
 		elif vmType == 'hvm':
-			disk0 = 'tap:%s'%disktype
+			disk0 = 'tap:%s' % self.disktype
 			diskU = 'hda1'
 
 

Modified: incubator/tashi/trunk/src/tashi/clustermanager/clustermanager.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/clustermanager.py?rev=1226207&r1=1226206&r2=1226207&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/clustermanager.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/clustermanager.py Sun Jan  1 01:51:40 2012
@@ -32,6 +32,8 @@ from tashi.rpycservices import rpycservi
 from rpyc.utils.server import ThreadedServer
 from rpyc.utils.authenticators import TlsliteVdbAuthenticator
 
+log = None
+
 def startClusterManager(config):
 	global service, data
 	
@@ -64,6 +66,8 @@ def startClusterManager(config):
 
 @signalHandler(signal.SIGTERM)
 def handleSIGTERM(signalNumber, stackFrame):
+	global log
+
 	log.info('Exiting cluster manager after receiving a SIGINT signal')
 	sys.exit(0)
 	

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=1226207&r1=1226206&r2=1226207&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/qemu.py Sun Jan  1 01:51:40 2012
@@ -539,7 +539,6 @@ class Qemu(VmControlInterface):
 		return vmId
 	
 	def suspendVm(self, vmId, target):
-		child = self.getChildFromPid(vmId)
 		tmpTarget = "/tmp/tashi_qemu_suspend_%d_%d" % (os.getpid(), vmId)
 		# XXX: Use fifo to improve performance
 		vmId = self.stopVm(vmId, "\"exec:gzip -c > %s\"" % (tmpTarget), True)
@@ -758,6 +757,7 @@ class Qemu(VmControlInterface):
 										self.stats[vmId]['%s_%s' % (device, label)] = int(val)
 					self.stats[vmId]['cpuLoad'] = cpuLoad
 					self.stats[vmId]['rss'] = rss
+					self.stats[vmId]['vsize'] = vsize
 					self.stats[vmId]['recvMBs'] = sendMBs
 					self.stats[vmId]['sendMBs'] = recvMBs
 			except:

Modified: incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/xenpv.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/xenpv.py?rev=1226207&r1=1226206&r2=1226207&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/xenpv.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/vmcontrol/xenpv.py Sun Jan  1 01:51:40 2012
@@ -111,6 +111,7 @@ class XenPV(VmControlInterface, threadin
 		self.transientDir = self.config.get('XenPV', 'transientDir')
 		self.defaultVmType = self.config.get('XenPV', 'defaultVmType') 
 		self.disktype = self.config.get('XenPV', 'defaultDiskType')
+		# XXXstroucki default disktype vhd?
 		self.newvms = listVms(self.vmNamePrefix)
 		self.hostId = -1
 		self.sleeptime = 5
@@ -133,7 +134,7 @@ class XenPV(VmControlInterface, threadin
 				# If the vm had transient disks, delete them
 				for i in range(len(a.disks)):
 					if a.disks[i].persistent == False:
-						diskname = self.transientDisk(a.id, i, disktype)
+						diskname = self.transientDisk(a.id, i, self.disktype)
 						try:
 							os.unlink(diskname)
 						except:
@@ -150,7 +151,7 @@ class XenPV(VmControlInterface, threadin
 			time.sleep(self.sleeptime)
 			self.cron()
 ########################################
-# This is an ugly function, but the muti-line string literal makes it
+# This is an ugly function, but the multi-line string literal makes it
 # a lot easier
 ########################################
 	def createXenConfig(self, vmName, 
@@ -167,12 +168,7 @@ class XenPV(VmControlInterface, threadin
 		vmType = hints.get('vmtype', self.defaultVmType)
 		print 'starting vm with type: ', vmType
 
-                try:
-                   disktype = self.config.get('XenPV', 'defaultDiskType')
-                except:
-                   disktype = 'vhd'
-
-                disk0 = 'tap:%s'%disktype
+                disk0 = 'tap:%s' % self.disktype
 		diskU = 'xvda1'
 
 		try:
@@ -216,7 +212,7 @@ kernel = "%s"
      ramdisk)
 
 		elif vmType == 'hvm':
-			disk0 = 'tap:%s'%disktype
+			disk0 = 'tap:%s' % self.disktype
 			diskU = 'hda1'
 
 



Mime
View raw message