incubator-tashi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gass, Richard" <richard.g...@intel.com>
Subject support for reserving hosts
Date Fri, 29 Jan 2010 20:26:13 GMT
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).  


Index: agents/primitive.py
===================================================================
--- agents/primitive.py	(revision 904607)
+++ agents/primitive.py	(working copy)
@@ -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)
Index: rpycservices/rpyctypes.py
===================================================================
--- rpycservices/rpyctypes.py	(revision 904599)
+++ rpycservices/rpyctypes.py	(working copy)
@@ -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__)



-- Richard Gass - <richard.gass@intel.com> - - - - - - 
Future Technologies Research, Intel Labs Pittsburgh 
4720 Forbes Avenue, Suite 410 - T: +1 412 297 4203 
Pittsburgh, PA 15213, USA     - F: +1 412 297 4110



Mime
View raw message