incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r905332 - in /incubator/tashi/trunk/src/tashi: agents/primitive.py rpycservices/rpyctypes.py
Date Mon, 01 Feb 2010 16:36:36 GMT
Author: stroucki
Date: Mon Feb  1 16:36:35 2010
New Revision: 905332

URL: http://svn.apache.org/viewvc?rev=905332&view=rev
Log:
This patch adds support for reserving physical hosts to a list of specified users.  Changes
are to rpyctypes.py and the scheduler (primitive.py).  Currently, the user creating the VM
will need to know what host has been reserved for him and will need to specify the host to
send his vm to (with the --hints targetHost=hostname option). (Thanks to Richard Gass <richardgass@gmail.com>)

Modified:
    incubator/tashi/trunk/src/tashi/agents/primitive.py
    incubator/tashi/trunk/src/tashi/rpycservices/rpyctypes.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=905332&r1=905331&r2=905332&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/agents/primitive.py (original)
+++ incubator/tashi/trunk/src/tashi/agents/primitive.py Mon Feb  1 16:36:35 2010
@@ -89,15 +89,26 @@
 							if (targetHost != None):
 								for h in hosts.values():
 									if ((str(h.id) == targetHost or h.name == targetHost)):
-										if (h.up == True and h.state == HostState.Normal):
+										#  make sure that host is up, in a normal state and is not reserved
+										if (h.up == True and h.state == HostState.Normal and len(h.reserved) == 0):
 											memUsage = reduce(lambda x, y: x + instances[y].memory, load[h.id], inst.memory)
 											coreUsage = reduce(lambda x, y: x + instances[y].cores, load[h.id], inst.cores)
 											if (memUsage <= h.memory and coreUsage <= h.cores):
 												minMax = len(load[h.id])
 												minMaxHost = h
+								
+										#  If a host machine is reserved, only allow if userid is in reserved list
+										if ((len(h.reserved) > 0) and inst.userId in h.reserved):
+											memUsage = reduce(lambda x, y: x + instances[y].memory, load[h.id], inst.memory)
+											coreUsage = reduce(lambda x, y: x + instances[y].cores, load[h.id], inst.cores)
+											if (memUsage <= h.memory and coreUsage <= h.cores):
+												minMax = len(load[h.id])
+												minMaxHost = h
+
+
 							if ((targetHost == None or allowElsewhere) and minMaxHost == None):
 								for h in hosts.values():
-									if (h.up == True and h.state == HostState.Normal):
+									if (h.up == True and h.state == HostState.Normal and len(h.reserved) == 0):
 										if (minMax is None or (self.densePack and len(load[h.id]) > minMax) or (not
self.densePack and len(load[h.id]) < minMax)):
 											memUsage = reduce(lambda x, y: x + instances[y].memory, load[h.id], inst.memory)
 											coreUsage = reduce(lambda x, y: x + instances[y].cores, load[h.id], inst.cores)

Modified: incubator/tashi/trunk/src/tashi/rpycservices/rpyctypes.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/rpycservices/rpyctypes.py?rev=905332&r1=905331&r2=905332&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/rpycservices/rpyctypes.py (original)
+++ incubator/tashi/trunk/src/tashi/rpycservices/rpyctypes.py Mon Feb  1 16:36:35 2010
@@ -69,6 +69,7 @@
 		self.cores = None
 		self.version = None
 		self.notes = None
+		self.reserved = []
 		if isinstance(d, dict):
 			if 'id' in d:
 				self.id = d['id']
@@ -88,6 +89,8 @@
 				self.version = d['version']
 			if 'notes' in d:
 				self.notes = d['notes']
+			if 'reserved' in d:
+				self.reserved = d['reserved']
 
 	def __str__(self): 
 		return str(self.__dict__)



Mime
View raw message