Tagging module NodeManager - NodeManager-1.7-42
[nodemanager.git] / bwmon.py
index 495fabd..8a9e96f 100644 (file)
--- a/bwmon.py
+++ b/bwmon.py
@@ -662,7 +662,10 @@ def getDefaults(nmdbcopy):
     return status
 
 def allOff():
-   # Get/set special slice IDs
+    """
+    Turn off all slice HTBs
+    """
+    # Get/set special slice IDs
     root_xid = bwlimit.get_xid("root")
     default_xid = bwlimit.get_xid("default")
     kernelhtbs = gethtbs(root_xid, default_xid)
@@ -682,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()