X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net.py;h=4bd7c71b38538b189b59545c93b1a72779a4ac88;hb=refs%2Fheads%2F1.7;hp=2e7f6eb0853748ce2a3ece11765e34e1b3a8f76d;hpb=43be22a4aee2c78a1b7c5e0bc42361a2b6b91df3;p=nodemanager.git diff --git a/net.py b/net.py index 2e7f6eb..4bd7c71 100644 --- a/net.py +++ b/net.py @@ -13,12 +13,24 @@ import sioc, plnet # local modules import bwlimit, logger, iptables -def GetSlivers(plc, data): - InitInterfaces(plc, data) - InitNodeLimit(data) - InitI2(plc, data) +def GetSlivers(plc, data, config): + logger.verbose("net:GetSlivers called.") + InitInterfaces(plc, data) # writes sysconfig files. + if 'OVERRIDES' in dir(config): + if config.OVERRIDES.get('net_max_rate') == '-1': + logger.log("net: Slice and node BW Limits disabled.") + if len(bwlimit.tc("class show dev eth0")): + logger.verbose("*** DISABLING NODE BW LIMITS ***") + bwlimit.stop() + else: + InitNodeLimit(data) + InitI2(plc, data) + else: + InitNodeLimit(data) + InitI2(plc, data) InitNAT(plc, data) + def InitNodeLimit(data): if not 'networks' in data: return @@ -29,8 +41,6 @@ def InitNodeLimit(data): for dev in devs: macs[sioc.gifhwaddr(dev).lower()] = dev - # XXX Exempt Internet2 destinations from node bwlimits - # bwlimit.exempt_init('Internet2', internet2_ips) for network in data['networks']: # Get interface name preferably from MAC address, falling # back on IP address. @@ -141,7 +151,7 @@ def InitNAT(plc, data): def InitInterfaces(plc, data): if not 'networks' in data: return - pyplnet.InitInterfaces(logger, plc, data) + plnet.InitInterfaces(logger, plc, data) def start(options, config): pass