Commit 9c073d6b by Stéphane Graber

lxc-ls: Detect missing setns support

parent 0dc29614
...@@ -172,6 +172,20 @@ if not os.geteuid() == 0 and (args.fancy or args.state): ...@@ -172,6 +172,20 @@ if not os.geteuid() == 0 and (args.fancy or args.state):
"Try running: sudo %s" "Try running: sudo %s"
% (sys.argv[0]))) % (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 # List of containers, stored as dictionaries
containers = [] containers = []
for container_name in lxc.list_containers(config_path=lxcpath): for container_name in lxc.list_containers(config_path=lxcpath):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment