From: Mark Huang Date: Tue, 6 Feb 2007 22:28:18 +0000 (+0000) Subject: - net_*_rate are in kbps because of XML-RPC maxint limitations X-Git-Tag: NodeManager-1.6-1~159 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c7858d1f8fb0a035e6cbd6608fd6bc5e307c6030;p=nodemanager.git - net_*_rate are in kbps because of XML-RPC maxint limitations - get primary bwlimit from GetSlivers() call, fix up default allocation appropriately --- diff --git a/sm.py b/sm.py index cdb42ee..956a11e 100644 --- a/sm.py +++ b/sm.py @@ -23,12 +23,12 @@ DEFAULT_ALLOCATION = { 'cpu_min': 0, # ms/s 'cpu_share': 32, # proportional share # bandwidth parameters - 'net_min_rate': bwmin, # bps - 'net_max_rate': bwmax, # bps + 'net_min_rate': bwmin / 1000, # kbps + 'net_max_rate': bwmax / 1000, # kbps 'net_share': 1, # proportional share # bandwidth parameters over routes exempt from node bandwidth limits - 'net_i2_min_rate': bwmin, # bps - 'net_i2_max_rate': bwmax, # bps + 'net_i2_min_rate': bwmin / 1000, # kbps + 'net_i2_max_rate': bwmax / 1000, # kbps 'net_i2_share': 1, # proportional share 'disk_max': 5000000 # bytes } @@ -51,6 +51,12 @@ def GetSlivers(data, fullupdate=True): except: logger.log_exc() if data.has_key('node_id') and data['node_id'] != node_id: return + + if data.has_key('networks'): + for network in data['networks']: + if network['is_primary'] and network['bwlimit'] is not None: + DEFAULT_ALLOCATION['net_max_rate'] = network['bwlimit'] / 1000 + for sliver in data['slivers']: rec = sliver.copy() rec.setdefault('timestamp', data['timestamp'])