Trellis branch to support network namespaces
[util-vserver-pl.git] / python / vserver.py
index 69e150c..654077f 100644 (file)
@@ -250,6 +250,13 @@ class VServer:
         # No clean way to do this right now.
         return None
 
+    def get_unshare_netns_config(self):
+        try:
+            unshare_netns = int(self.config.get('spaces/net'))
+        except:
+            unshare_netns = 0;
+        return unshare_netns;
+
     def __do_chroot(self):
         os.chroot(self.dir)
         os.chdir("/")
@@ -368,7 +375,7 @@ class VServer:
             print >>state_file, "%u" % self.ctx
             state_file.close()
 
-        if vserverimpl.chcontext(self.ctx, vserverimpl.text2bcaps(self.get_capabilities_config())):
+        if vserverimpl.chcontext(self.ctx, vserverimpl.text2bcaps(self.get_capabilities_config()), self.get_unshare_netns_config()):
             self.set_resources()
             vserverimpl.setup_done(self.ctx)