Work around race condition when NodeManager is starting the vserver
[nodemanager-topo.git] / topo.py
diff --git a/topo.py b/topo.py
index 03c2636..b2beba5 100755 (executable)
--- a/topo.py
+++ b/topo.py
@@ -392,7 +392,7 @@ an 'egre_key' attribute, and a 'topo_rspec' attribute.
 Creating the virtual link depends on the contents of 
 /etc/vservers/<slice>/spaces/net.  Update this first.
 """
-def GetSlivers(data):
+def GetSlivers(data, config = None, plc = None):
     global ifaces, old_ifaces
     ifaces = old_ifaces = sioc.gifconf()
 
@@ -405,11 +405,12 @@ def GetSlivers(data):
                 slicekeys[sliver['name']] = tag['value']
                 
 
-        if 'netns' in attrs:
-            netns = int(attrs['netns'])
-        else:
-            netns = 0
-        write_conf_and_restart(sliver['name'], netns)
+        if vserver.VServer(sliver['name']).is_running():
+            if 'netns' in attrs:
+                netns = int(attrs['netns'])
+            else:
+                netns = 0
+            write_conf_and_restart(sliver['name'], netns)
 
         if vserver.VServer(sliver['name']).is_running():
             if 'egre_key' in attrs: