Commit 9ec38a6d by Stéphane Graber

lxc-ls: Add interfaces field

parent 860490af
......@@ -102,7 +102,7 @@ def get_root_path(path):
# Constants
FIELDS = ("name", "state", "ipv4", "ipv6", "autostart", "pid",
FIELDS = ("name", "state", "interfaces", "ipv4", "ipv6", "autostart", "pid",
"memory", "ram", "swap")
DEFAULT_FIELDS = ("name", "state", "ipv4", "ipv6", "autostart")
......@@ -323,6 +323,18 @@ def get_containers(fd=None, base="/", root=False):
if ips:
entry[protocol] = ", ".join(ips)
# Get the interfaces
if 'interfaces' in args.fancy_format:
entry['interfaces'] = "-"
if state == 'UNKNOWN' or (container.running and
not SUPPORT_SETNS_NET):
entry['interfaces'] = "UNKNOWN"
elif container.running:
interfaces = container.get_interfaces()
if interfaces:
entry['interfaces'] = ", ".join(interfaces)
# Nested containers
if args.nesting:
if container.running:
......
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