From 9575e34c9d9beb402883d99565e609e2017d9f9f Mon Sep 17 00:00:00 2001 From: Andy Bavier Date: Mon, 21 Jan 2008 19:39:20 +0000 Subject: [PATCH] Change cpu_min to cpu_pct to avoid name conflict with attributes affecting rlimits --- database.py | 2 +- sliver_vs.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/database.py b/database.py index 8681539..92c5ef4 100644 --- a/database.py +++ b/database.py @@ -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' diff --git a/sliver_vs.py b/sliver_vs.py index b0497c4..2f183c8 100644 --- a/sliver_vs.py +++ b/sliver_vs.py @@ -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'])) -- 2.43.0