[lxc-devel] [PATCH] lxc-ls: Optimize things a bit
Stéphane Graber
stgraber at ubuntu.com
Sun Mar 23 03:27:28 UTC 2014
Don't bother access information that the user didn't request.
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
src/lxc/lxc-ls.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/lxc/lxc-ls.in b/src/lxc/lxc-ls.in
index 7e35ab2..4665314 100755
--- a/src/lxc/lxc-ls.in
+++ b/src/lxc/lxc-ls.in
@@ -244,17 +244,17 @@ def get_containers(fd=None, base="/", root=False):
continue
# Some extra field we may want
- if 'state' in args.fancy_format or args.nesting:
+ if 'state' in args.fancy_format:
entry['state'] = state
- if 'pid' in args.fancy_format or args.nesting:
+ if 'pid' in args.fancy_format:
entry['pid'] = "-"
if state == 'UNKNOWN':
entry['pid'] = state
elif container.init_pid != -1:
entry['pid'] = str(container.init_pid)
- if 'autostart' in args.fancy_format or args.nesting:
+ if 'autostart' in args.fancy_format:
entry['autostart'] = "NO"
try:
if container.get_config_item("lxc.start.auto") == "1":
@@ -307,7 +307,7 @@ def get_containers(fd=None, base="/", root=False):
# Get the IPs
for family, protocol in {'inet': 'ipv4', 'inet6': 'ipv6'}.items():
- if protocol in args.fancy_format or args.nesting:
+ if protocol in args.fancy_format:
entry[protocol] = "-"
if state == 'UNKNOWN':
--
1.9.1
More information about the lxc-devel
mailing list