Make sure the new process has its net namespace unshared.
authorSapan Bhatia <sapanb@cs.princeton.edu>
Fri, 18 Dec 2009 22:05:58 +0000 (22:05 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Fri, 18 Dec 2009 22:05:58 +0000 (22:05 +0000)
exec/run_with_devices.py [moved from exec/run_with_devices.pl with 87% similarity]

similarity index 87%
rename from exec/run_with_devices.pl
rename to exec/run_with_devices.py
index 17132c4..c0b2312 100644 (file)
@@ -42,7 +42,15 @@ if (pid):
     args = [slicename]
     args += ['exec']
     args += [command_name]
-    os.execve(vserver_command, args)
+
+    os.system('touch /etc/vservers/%s/spaces/net'%slicename)
+
+    try:    
+        os.execve(vserver_command, args)
+    except:
+        pass
+
+    os.system('rm /etc/vservers/%s/spaces/net'%slicename)
 else:
     for vif in device_names:
         os.system('/sbin/ip link set %s netns %d'%(vif, pid))