Change cpu_min to cpu_pct to avoid name conflict with attributes affecting rlimits
authorAndy Bavier <acb@cs.princeton.edu>
Mon, 21 Jan 2008 19:39:20 +0000 (19:39 +0000)
committerAndy Bavier <acb@cs.princeton.edu>
Mon, 21 Jan 2008 19:39:20 +0000 (19:39 +0000)
database.py
sliver_vs.py

index 8681539..92c5ef4 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': 1, 'net_min_rate': 0, 'net_max_rate': 8, 'net_i2_min_rate': 0, 'net_i2_max_rate': 8, 'net_share': 1}
+MINIMUM_ALLOCATION = {'cpu_pct': 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 b0497c4..2f183c8 100644 (file)
@@ -162,21 +162,21 @@ class Sliver_VS(accounts.Account, vserver.VServer):
             logger.log('%s: setting net share to %d' % (self.name, net_limits[-1]))
             self.set_bwlimit(*net_limits)
 
-        cpu_min = self.rspec['cpu_min']
+        cpu_pct = self.rspec['cpu_pct']
         cpu_share = self.rspec['cpu_share']
 
         if self.rspec['enabled'] > 0:
-            if cpu_min > 0:
-                logger.log('%s: setting cpu reservation to %d%%' % (self.name, cpu_min))
+            if cpu_pct > 0:
+                logger.log('%s: setting cpu reservation to %d%%' % (self.name, cpu_pct))
             else:
-                cpu_min = 0
+                cpu_pct = 0
 
             if cpu_share > 0:
                 logger.log('%s: setting cpu share to %d' % (self.name, cpu_share))
             else:
                 cpu_share = 0
 
-            self.set_sched_config(cpu_min, cpu_share)
+            self.set_sched_config(cpu_pct, 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']))