Assume each slice has a network namespace already
Andy Bavier [Fri, 30 Oct 2009 15:14:36 +0000 (15:14 +0000)]
NodeManager-topo.spec
topo.py

index afabb5c..523cb3f 100644 (file)
@@ -2,7 +2,7 @@
 
 Name:          NodeManager-topo
 Version:       0.5
-Release:       7
+Release:       8
 Summary:       Plugin supporting creating a default virtual topology.
 
 Group:         System Environment/Daemons
diff --git a/topo.py b/topo.py
index b2beba5..7f96281 100755 (executable)
--- a/topo.py
+++ b/topo.py
@@ -181,9 +181,10 @@ def update_nat(slice, myid, key, netns):
 
 
 """
-Write /etc/vservers/<slicename>/spaces/net.  If the vserver is running and the spaces/net file is modified, we need to restart it.
+Write /etc/vservers/<slicename>/spaces/net.  
+Assumes that the vserver was started with a network namespace.
 """
-def write_conf_and_restart(slicename, value):
+def write_spaces_net(slicename, value):
     SLICEDIR="/etc/vservers/%s/" % slicename
     SPACESDIR="%s/spaces/" % SLICEDIR
     FILENAME="%s/net" % SPACESDIR
@@ -197,11 +198,7 @@ def write_conf_and_restart(slicename, value):
             
         if os.path.exists(FILENAME) != value:
             sliver = vserver.VServer(slicename)
-            restart = sliver.is_running()
             
-            if (restart):
-                sliver.stop()
-                
             if value:
                 STATUS="ON"
                 f = open(FILENAME, "w")
@@ -212,10 +209,6 @@ def write_conf_and_restart(slicename, value):
                 
             logger.log("%s: network namespace %s\n" % (slicename, STATUS))
 
-            if (restart):
-                logger.log("topo: restarting sliver %s\n" % slicename)
-                sliver.start()
-
 
 """
 Generate information for each interface in the sliver, in order to configure
@@ -410,7 +403,7 @@ def GetSlivers(data, config = None, plc = None):
                 netns = int(attrs['netns'])
             else:
                 netns = 0
-            write_conf_and_restart(sliver['name'], netns)
+            write_spaces_net(sliver['name'], netns)
 
         if vserver.VServer(sliver['name']).is_running():
             if 'egre_key' in attrs: