]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-ls: Detect missing setns support
authorStéphane Graber <stgraber@ubuntu.com>
Wed, 11 Dec 2013 19:02:20 +0000 (14:02 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 11 Dec 2013 19:58:12 +0000 (14:58 -0500)
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxc-ls [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 9d45400..26c9684
@@ -172,6 +172,20 @@ if not os.geteuid() == 0 and (args.fancy or args.state):
                    "Try running: sudo %s"
                    % (sys.argv[0])))
 
+## Nesting requires setns to pid and net ns
+if args.nesting:
+    if not os.path.exists("/proc/self/ns/"):
+        parser.error(_("Showing nested containers requires setns support "
+                       "which your kernel doesn't support."))
+
+    if not "pid" in os.listdir("/proc/self/ns/"):
+        parser.error(_("Showing nested containers requires setns to the "
+                       "PID namespace which your kernel doesn't support."))
+
+    if not "net" in os.listdir("/proc/self/ns/"):
+        parser.error(_("Showing nested containers requires setns to the "
+                       "network namespace which your kernel doesn't support."))
+
 # List of containers, stored as dictionaries
 containers = []
 for container_name in lxc.list_containers(config_path=lxcpath):