Restart the veserver if spaces/net changes
authorAndy Bavier <acb@cs.princeton.edu>
Mon, 30 Nov 2009 19:33:20 +0000 (19:33 +0000)
committerAndy Bavier <acb@cs.princeton.edu>
Mon, 30 Nov 2009 19:33:20 +0000 (19:33 +0000)
NodeManager-topo.spec
topo.py

index 523cb3f..54f769d 100644 (file)
@@ -2,7 +2,7 @@
 
 Name:          NodeManager-topo
 Version:       0.5
-Release:       8
+Release:       9
 Summary:       Plugin supporting creating a default virtual topology.
 
 Group:         System Environment/Daemons
diff --git a/topo.py b/topo.py
index 7f96281..559d417 100755 (executable)
--- a/topo.py
+++ b/topo.py
@@ -182,7 +182,7 @@ def update_nat(slice, myid, key, netns):
 
 """
 Write /etc/vservers/<slicename>/spaces/net.  
-Assumes that the vserver was started with a network namespace.
+Restart the vserver if there are any changes.
 """
 def write_spaces_net(slicename, value):
     SLICEDIR="/etc/vservers/%s/" % slicename
@@ -199,6 +199,8 @@ def write_spaces_net(slicename, value):
         if os.path.exists(FILENAME) != value:
             sliver = vserver.VServer(slicename)
             
+            sliver.stop()
+
             if value:
                 STATUS="ON"
                 f = open(FILENAME, "w")
@@ -206,7 +208,9 @@ def write_spaces_net(slicename, value):
             else:
                 STATUS="OFF"
                 os.remove(FILENAME)
-                
+
+            sliver.start()
+
             logger.log("%s: network namespace %s\n" % (slicename, STATUS))
 
 
@@ -326,7 +330,6 @@ def update_quagga_configs(slicename, hostname, myid, topo, key, netns):
     quagga_dir = "/vservers/%s/etc/quagga/" % slicename
     if not os.path.exists(quagga_dir):
         try:
-            # Quagga not installed.  Install it here?  Chkconfig, sym links.
             os.mkdir(quagga_dir)
         except os.error:
             logger.log("topo: could not create %s\n" % quagga_dir)
@@ -336,8 +339,6 @@ def update_quagga_configs(slicename, hostname, myid, topo, key, netns):
                 myid, key)
     write_ospf(quagga_dir + "ospfd.conf.generated", hostname, ifaces)
 
-    # Start up Quagga if we installed it earlier and netns = 1.
-
     return
 
 
@@ -374,6 +375,7 @@ def write_egre_keys(slicekeys):
 Executed on NM startup
 """
 def start(options, config):
+    # Should be taken care of by /etc/sysctl.conf, but it doesn't hurt...
     run ("echo 1 > /proc/sys/net/ipv4/ip_forward")
     pass