patch by Thomas Dreibholz - ovs-vsctl and not ovs-ovsctl
[nodemanager.git] / bwmon.py
index 0b825cf..476ef6d 100644 (file)
--- a/bwmon.py
+++ b/bwmon.py
@@ -23,7 +23,8 @@ import socket
 import copy
 import threading
 
-import bwlimitlxc as bwlimit
+import plnode.bwlimit as bwlimit
+
 import logger
 import tools
 import database
@@ -422,7 +423,7 @@ class Slice:
         if (runningrates['maxrate'] != new_maxrate) or \
         (runningrates['minrate'] != self.MinRate * 1000) or \
         (runningrates['maxexemptrate'] != new_maxi2rate) or \
-        (runningrates['minexemptrate'] != self.Mini2Rate * 1000) or \
+        ('minexemptrate' in runningrates and runningrates['minexemptrate'] != self.Mini2Rate * 1000) or \
         (runningrates['share'] != self.Share):
             # Apply parameters
             bwlimit.set(xid = self.xid, dev = dev_default,
@@ -481,8 +482,8 @@ def sync(nmdbcopy):
         period, \
         default_MaxRate, \
         default_Maxi2Rate, \
-        default_MaxKByte,\
-        default_Maxi2KByte,\
+        default_MaxKByte, \
+        default_Maxi2KByte, \
         default_Share, \
         dev_default
 
@@ -655,7 +656,7 @@ def sync(nmdbcopy):
             # Update byte counts
             slice.update(kernelhtbs[xid], live[xid]['_rspec'])
 
-    logger.verbose("bwmon: Saving %s slices in %s" % (slices.keys().__len__(),DB_FILE))
+    logger.verbose("bwmon: Saving %s slices in %s" % (slices.keys().__len__(), DB_FILE))
     f = open(DB_FILE, "w")
     pickle.dump((version, slices, deaddb), f)
     f.close()