Work around race condition when NodeManager is starting the vserver
authorAndy Bavier <acb@cs.princeton.edu>
Mon, 19 Oct 2009 20:26:45 +0000 (20:26 +0000)
committerAndy Bavier <acb@cs.princeton.edu>
Mon, 19 Oct 2009 20:26:45 +0000 (20:26 +0000)
topo.py

diff --git a/topo.py b/topo.py
index be68831..b2beba5 100755 (executable)
--- a/topo.py
+++ b/topo.py
@@ -405,11 +405,12 @@ def GetSlivers(data, config = None, plc = None):
                 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: