[libvirt] [sandbox PATCH 3/3] Do not run a shell within a lxc container by default.

dwalsh at redhat.com dwalsh at redhat.com
Mon Apr 22 16:26:31 UTC 2013


From: Dan Walsh <dwalsh at redhat.com>

We want to make sure we use as little overhead as possible.
If a user connects to a lxc container, it will be the same as executing
a shell within the container.
---
 bin/virt-sandbox-service | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index dd30993..4d2d1cd 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -271,7 +271,8 @@ class Container:
 
     def create(self):
         self.connect()
-        self.config.set_shell(True)
+        if self.uri != "lxc:///":
+            self.config.set_shell(True)
         if not os.path.exists(self.dest):
             os.mkdir(self.dest)
 
@@ -843,6 +844,18 @@ def stop(args):
              "-S", args.name)
 
 def connect(args):
+    if args.uri == "lxc:///":
+        class Args:
+            command = []
+            noseclabel = None
+            name = args.name
+            uri = args.uri
+
+        args = Args()
+        args.command = [ "/bin/sh" ]
+        execute(args)
+        return
+
     print """\
 Connected to %s.
 Type 'Ctrl + ]' to detach from the console.
-- 
1.8.2




More information about the libvir-list mailing list