rerun initscript with 'restart' argument if the initscript is changed after the slive...
[nodemanager.git] / slivermanager.py
index 8f1ae3e..b7c5439 100644 (file)
@@ -1,6 +1,4 @@
-# $Id$
-# $URL$
-
+#
 """Sliver manager.
 
 The sliver manager has several functions.  It is responsible for
@@ -31,6 +29,7 @@ DEFAULT_ALLOCATION = {
     # CPU parameters
     'cpu_pct': 0, # percent CPU reserved
     'cpu_share': 1, # proportional share
+    'cpu_cores': 0, # reserved cpu cores
     # bandwidth parameters
     'net_min_rate': bwmin / 1000, # kbps
     'net_max_rate': bwmax / 1000, # kbps
@@ -180,15 +179,18 @@ def GetSlivers(data, config = None, plc=None, fullupdate=True):
         for resname, default_amount in DEFAULT_ALLOCATION.iteritems():
             try:
                 t = type(default_amount)
-                amt = t.__new__(t, attributes[resname])
-            except (KeyError, ValueError): amt = default_amount
-            rspec[resname] = amt
+                amount = t.__new__(t, attributes[resname])
+            except (KeyError, ValueError): amount = default_amount
+            rspec[resname] = amount
 
         # add in sysctl attributes into the rspec
         for key in attributes.keys():
             if key.find("sysctl.") == 0:
                 rspec[key] = attributes[key]
 
+        # also export tags in rspec so they make it to the sliver_vs.start call
+        rspec['tags']=attributes
+
         database.db.deliver_record(rec)
     if fullupdate: database.db.set_min_timestamp(data['timestamp'])
     # slivers are created here.