From: Faiyaz Ahmed Date: Fri, 30 Jan 2009 23:50:47 +0000 (+0000) Subject: Can add and remove bw accounting without reboots. X-Git-Tag: NodeManager-1.7-42~2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=197c617ee6e9c0227aee6387e14505a8c075e5d0;p=nodemanager.git Can add and remove bw accounting without reboots. --- diff --git a/bwmon.py b/bwmon.py index 6f5c90e..8a9e96f 100644 --- a/bwmon.py +++ b/bwmon.py @@ -685,8 +685,10 @@ def run(): nmdbcopy = copy.deepcopy(database.db) database.db_lock.release() try: - if getDefaults(nmdbcopy): sync(nmdbcopy) - else: logger.log("bwmon: DISABLED.") + if getDefaults(nmdbcopy) and len(bwlimit.tc("class show dev eth0")) > 0: + # class show to check if net:InitNodeLimit:bwlimit.init has run. + sync(nmdbcopy) + else: logger.log("bwmon: BW limits DISABLED.") except: logger.log_exc() lock.clear() diff --git a/net.py b/net.py index ba48959..1c34b2b 100644 --- a/net.py +++ b/net.py @@ -14,12 +14,17 @@ import sioc, plnet import bwlimit, logger, iptables def GetSlivers(plc, data, config): + logger.verbose("net:GetSlivers called.") InitInterfaces(plc, data) # writes sysconfig files. - if ('OVERRIDES' in dir(config)) and (config.OVERRIDES.get('net_max_rate') == -1): - logger.log("Slice and node BW Limits disabled.") - if len(bwlimit.get()): - logger.verbose("*** DISABLING NODE BW LIMITS ***") - bwlimit.stop() + 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) diff --git a/nm.py b/nm.py index 78c7bfa..744ba76 100755 --- a/nm.py +++ b/nm.py @@ -84,7 +84,8 @@ def getPLCDefaults(data, config): if len(attr_dict): logger.verbose("Found default slice overrides.\n %s" % attr_dict) config.OVERRIDES = attr_dict - elif 'OVERRIDES' in dir(config): del config.OVERRIDES + return + if 'OVERRIDES' in dir(config): del config.OVERRIDES def run():