incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1179498 - in /incubator/tashi: site/docs/documentation.html site/xdocs/documentation-primitive.xml site/xdocs/documentation.xml trunk/src/tashi/agents/primitive.py trunk/src/tashi/client/tashi-client.py
Date Thu, 06 Oct 2011 04:21:19 GMT
Author: stroucki
Date: Thu Oct  6 04:21:18 2011
New Revision: 1179498

URL: http://svn.apache.org/viewvc?rev=1179498&view=rev
Log:
primitive: Allow user to specify a hint in regards to packing policy
tashi-client: Consume arguments and raise error on encountering an "unhandled" argument. Should
avoid disappointment when users mistakenly supply --mem or -cores arguments :) Greets to Elie.


Added:
    incubator/tashi/site/xdocs/documentation-primitive.xml
Modified:
    incubator/tashi/site/docs/documentation.html
    incubator/tashi/site/xdocs/documentation.xml
    incubator/tashi/trunk/src/tashi/agents/primitive.py
    incubator/tashi/trunk/src/tashi/client/tashi-client.py

Modified: incubator/tashi/site/docs/documentation.html
URL: http://svn.apache.org/viewvc/incubator/tashi/site/docs/documentation.html?rev=1179498&r1=1179497&r2=1179498&view=diff
==============================================================================
--- incubator/tashi/site/docs/documentation.html (original)
+++ incubator/tashi/site/docs/documentation.html Thu Oct  6 04:21:18 2011
@@ -110,6 +110,9 @@ table.options td {
 <a href="documentation-xenpv.html">The XenPV backend of Tashi</a>
 </p>
                                                                                         
       <p>
+<a href="documentation-primitive.html">The primitive scheduler</a>
+</p>
+                                                                                        
       <p>
 <a href="documentation-options.html">Configuration options for Tashi</a>
 </p>
                                                                             </td>

Added: incubator/tashi/site/xdocs/documentation-primitive.xml
URL: http://svn.apache.org/viewvc/incubator/tashi/site/xdocs/documentation-primitive.xml?rev=1179498&view=auto
==============================================================================
--- incubator/tashi/site/xdocs/documentation-primitive.xml (added)
+++ incubator/tashi/site/xdocs/documentation-primitive.xml Thu Oct  6 04:21:18 2011
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.    
+-->
+
+<document>
+
+  <properties>
+    <title>Documentation</title>
+  </properties>
+
+<body>
+
+<section name="The primitive scheduler">
+
+<p>
+The primitive scheduler examines the table of VMs for machines in the Pending state (requested,
but not yet created), and based on the current available resources, will deploy the VM onto
a machine it identified.
+</p>
+<p>
+Criteria for placing the VM include packing policy, host availability etc.
+</p>
+<p>
+The following hints are useful with the primitive scheduler:
+<ul>
+<li>densePack</li>
+This option sets a preference for matching VMs to hosts. If set to True, the scheduler will
prefer placing a VM on a host with the minimum available resources. If set to False, the scheduler
will prefer placement on a fully open host instead. Default policy is given via the scheduler
configuration.
+</ul>
+</p>
+
+</section>
+
+</body>
+</document>

Modified: incubator/tashi/site/xdocs/documentation.xml
URL: http://svn.apache.org/viewvc/incubator/tashi/site/xdocs/documentation.xml?rev=1179498&r1=1179497&r2=1179498&view=diff
==============================================================================
--- incubator/tashi/site/xdocs/documentation.xml (original)
+++ incubator/tashi/site/xdocs/documentation.xml Thu Oct  6 04:21:18 2011
@@ -41,6 +41,9 @@
 <a href="documentation-xenpv.html">The XenPV backend of Tashi</a>
 </p>
 <p>
+<a href="documentation-primitive.html">The primitive scheduler</a>
+</p>
+<p>
 <a href="documentation-options.html">Configuration options for Tashi</a>
 </p>
 

Modified: incubator/tashi/trunk/src/tashi/agents/primitive.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/agents/primitive.py?rev=1179498&r1=1179497&r2=1179498&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/agents/primitive.py (original)
+++ incubator/tashi/trunk/src/tashi/agents/primitive.py Thu Oct  6 04:21:18 2011
@@ -105,6 +105,12 @@ class Primitive(object):
 			minMax = None
 			minMaxHost = None
 			minMaxCtr = None
+
+			densePack = inst.hints.get("densePack", None)
+			if (densePack is None):
+				densePack = self.densePack
+			else:
+				densePack = boolean(densePack)
 			
 			targetHost = inst.hints.get("targetHost", None)
 			try:
@@ -151,7 +157,7 @@ class Primitive(object):
 					# minMax has not been modified  or
 					# the number of vms here is greater than minmax if we're dense packing or
 					# the number of vms here is less than minmax if we're not dense packing
-					if (minMax is None or (self.densePack and len(self.load[h.id]) > minMax) or (not
self.densePack and len(self.load[h.id]) < minMax)):
+					if (minMax is None or (densePack and len(self.load[h.id]) > minMax) or (not densePack
and len(self.load[h.id]) < minMax)):
 						if self.__checkCapacity(h, inst):
 							minMax = len(self.load[h.id])
 							minMaxHost = h

Modified: incubator/tashi/trunk/src/tashi/client/tashi-client.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/client/tashi-client.py?rev=1179498&r1=1179497&r2=1179498&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/client/tashi-client.py (original)
+++ incubator/tashi/trunk/src/tashi/client/tashi-client.py Thu Oct  6 04:21:18 2011
@@ -500,30 +500,57 @@ def main():
 		usage()
 	function = matchFunction(sys.argv[1])
 	(config, configFiles) = getConfig(["Client"])
-	possibleArgs = argLists[function]
+
+	# build a structure of possible arguments
+	possibleArgs = {}
+	argList = argLists[function]
+	for i in range(0, len(argList)):
+		possibleArgs[argList[i][0]]=argList[i]
+
 	args = sys.argv[2:]
-	for arg in args:
-		if (arg == "--help" or arg == "--examples"):
-			usage(function)
+
+	vals = {}
+
 	try:
-		vals = {}
+		# create client handle
 		client = createClient(config)
-		for parg in possibleArgs:
+
+		# set defaults
+		for parg in possibleArgs.values():
 			(parg, conv, default, required) = parg
-			val = None
-			for i in range(0, len(args)):
-				arg = args[i]
-				if (arg.startswith("--") and arg[2:] == parg):
-					val = conv(args[i+1])
-			if (val == None):
-				val = default()
-			vals[parg] = val
-		for arg in args:
+			if (required is False):
+				vals[parg] = default()
+
+		while (len(args) > 0):
+			arg = args.pop(0)
+
+			if (arg == "--help" or arg == "--examples"):
+				usage(function)
+				# this exits
+
 			if (arg.startswith("--hide-")):
 				show_hide.append((False, arg[7:]))
+				continue
+
 			if (arg.startswith("--show-")):
 				show_hide.append((True, arg[7:]))
+				continue
+
+			if (arg.startswith("--")):
+				if (arg[2:] in possibleArgs):
+					(parg, conv, default, required) = possibleArgs[arg[2:]]
+					val = conv(args.pop(0))
+					if (val == None):
+						val = default()
+
+					vals[parg] = val
+					continue
+
+			raise ValueError("Unknown argument %s" % (arg)) 
+
+		
 		f = getattr(client, function, None)
+
 		if (f is None):
 			f = extraViews[function][0]
 		if (function in convertArgs):



Mime
View raw message