incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rg...@apache.org
Subject svn commit: r1200077 - /incubator/tashi/trunk/src/tashi/agents/primitive.py
Date Thu, 10 Nov 2011 01:03:17 GMT
Author: rgass
Date: Thu Nov 10 01:03:16 2011
New Revision: 1200077

URL: http://svn.apache.org/viewvc?rev=1200077&view=rev
Log:
adding a check to make sure we don't mount a VM image persistent more than once.


Modified:
    incubator/tashi/trunk/src/tashi/agents/primitive.py

Modified: incubator/tashi/trunk/src/tashi/agents/primitive.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/agents/primitive.py?rev=1200077&r1=1200076&r2=1200077&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/agents/primitive.py (original)
+++ incubator/tashi/trunk/src/tashi/agents/primitive.py Thu Nov 10 01:03:16 2011
@@ -110,6 +110,7 @@ class Primitive(object):
 	def __scheduleInstance(self, inst):
 
 		try:
+
 			minMax = None
 			minMaxHost = None
 			minMaxCtr = None
@@ -191,7 +192,20 @@ class Primitive(object):
 							minMax = len(self.load[h.id])
 							minMaxHost = h
 							minMaxCtr = ctr
-		
+
+					#  check that VM image isn't mounted persistent already
+					#  Should set a status code to alert user
+					#  Tried to update the state of the instance and set persistent=False but 
+					#  couldn't do it, should work until we find a better way to do this
+					if inst.disks[0].persistent == True:
+						count = 0
+						myDisk = inst.disks[0].uri
+						for i in self.cm.getInstances():
+							if myDisk == i.disks[0].uri and i.disks[0].persistent == True:
+								count += 1
+						if count > 1:
+								minMaxHost = None
+
 			if (minMaxHost):
 				# found a host
 				if (not inst.hints.get("__resume_source", None)):



Mime
View raw message