Change default CPU share from 32 to 1
authorAndy Bavier <acb@cs.princeton.edu>
Wed, 16 Jan 2008 22:03:59 +0000 (22:03 +0000)
committerAndy Bavier <acb@cs.princeton.edu>
Wed, 16 Jan 2008 22:03:59 +0000 (22:03 +0000)
NodeManager.spec
database.py
sliver_vs.py
sm.py

index bbef345..eb074f0 100644 (file)
@@ -4,7 +4,7 @@
 %define url $URL$
 
 %define name NodeManager
-%define version 1.6
+%define version 1.7
 %define taglevel 1
 
 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
index a834fd8..8681539 100644 (file)
@@ -23,7 +23,7 @@ import bwmon
 
 # We enforce minimum allocations to keep the clueless from hosing their slivers.
 # Disallow disk loans because there's currently no way to punish slivers over quota.
-MINIMUM_ALLOCATION = {'cpu_min': 0, 'cpu_share': 32, 'net_min_rate': 0, 'net_max_rate': 8, 'net_i2_min_rate': 0, 'net_i2_max_rate': 8, 'net_share': 1}
+MINIMUM_ALLOCATION = {'cpu_min': 0, 'cpu_share': 1, 'net_min_rate': 0, 'net_max_rate': 8, 'net_i2_min_rate': 0, 'net_i2_max_rate': 8, 'net_share': 1}
 LOANABLE_RESOURCES = MINIMUM_ALLOCATION.keys()
 
 DB_FILE = '/root/sliver_mgr_db.pickle'
index 3e0067e..ab5c391 100644 (file)
@@ -163,12 +163,17 @@ class Sliver_VS(accounts.Account, vserver.VServer):
         cpu_share = self.rspec['cpu_share']
 
         if self.rspec['enabled'] > 0:
-            if cpu_min >= 50:  # at least 5%: keep people from shooting themselves in the foot
-                logger.log('%s: setting cpu share to %d%% guaranteed' % (self.name, cpu_min/10.0))
-                self.set_sched_config(cpu_min, vserver.SCHED_CPU_GUARANTEED)
+            if cpu_min > 0:
+                logger.log('%s: setting cpu to %d%% guaranteed' % (self.name, cpu_min))
             else:
+                cpu_min = 0
+
+            if cpu_share > 0:
                 logger.log('%s: setting cpu share to %d' % (self.name, cpu_share))
-                self.set_sched_config(cpu_share, 0)
+            else:
+                cpu_share = 0
+
+            self.set_sched_config(cpu_min, cpu_share)
             # if IP address isn't set (even to 0.0.0.0), sliver won't be able to use network
             if self.rspec['ip_addresses'] != '0.0.0.0':
                 logger.log('%s: setting IP address(es) to %s' % (self.name, self.rspec['ip_addresses']))
diff --git a/sm.py b/sm.py
index b291506..9f0544c 100644 (file)
--- a/sm.py
+++ b/sm.py
@@ -23,8 +23,8 @@ import string,re
 DEFAULT_ALLOCATION = {
     'enabled': 1,
     # CPU parameters
-    'cpu_min': 0, # ms/s
-    'cpu_share': 32, # proportional share
+    'cpu_min': 0, # percent CPU reserved
+    'cpu_share': 1, # proportional share
     # bandwidth parameters
     'net_min_rate': bwmin / 1000, # kbps
     'net_max_rate': bwmax / 1000, # kbps