From 9c073d6b763c1b1bf52669c07fc4782548b3a69a Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Graber?= Date: Wed, 11 Dec 2013 14:02:20 -0500 Subject: [PATCH] lxc-ls: Detect missing setns support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn --- src/lxc/lxc-ls | 14 ++++++++++++++ 1 file changed, 14 insertions(+) mode change 100644 => 100755 src/lxc/lxc-ls diff --git a/src/lxc/lxc-ls b/src/lxc/lxc-ls old mode 100644 new mode 100755 index 9d4540018..26c968459 --- a/src/lxc/lxc-ls +++ b/src/lxc/lxc-ls @@ -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): -- 2.47.3