log subprocess calls.
[nodemanager.git] / net.py
diff --git a/net.py b/net.py
index 2e7f6eb..4bd7c71 100644 (file)
--- 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