When using -P (lxcpath), the parameter path needs to be forwarded to the various commands being run but not used by the nested lxc-ls as it's relatively unlikely that both the host and the nested containers use a custom path.
This isn't ideal but short of having a way to provide the container path for every single of the nesting (with potential unlimited depth), it's the best we can do. Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- src/lxc/lxc-ls | 5 +++-- src/python-lxc/lxc/__init__.py | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lxc/lxc-ls b/src/lxc/lxc-ls index 4308ede..d4e369b 100644 --- a/src/lxc/lxc-ls +++ b/src/lxc/lxc-ls @@ -89,12 +89,13 @@ def getTerminalSize(): def getSubContainers(container, lxcpath): - attach = ['lxc-attach', '-R', '-s', 'NETWORK|PID', '-n', container, + attach = ['lxc-attach', '-P', lxcpath, '-R', '-s', 'NETWORK|PID', + '-n', container, '--', sys.argv[0], "--nesting"] with open(os.devnull, "w") as fd: newenv = dict(os.environ) - newenv['NESTED'] = "/proc/1/root/%s" % lxcpath + newenv['NESTED'] = "/proc/1/root/%s" % lxc.default_config_path sp = subprocess.Popen(attach, stderr=fd, stdout=subprocess.PIPE, env=newenv, universal_newlines=True) sp.wait() diff --git a/src/python-lxc/lxc/__init__.py b/src/python-lxc/lxc/__init__.py index e3ce8eb..c235d18 100644 --- a/src/python-lxc/lxc/__init__.py +++ b/src/python-lxc/lxc/__init__.py @@ -347,7 +347,8 @@ class Container(_lxc.Container): if count != 0: time.sleep(1) - base_cmd = ["lxc-attach", "-s", "NETWORK", "-n", self.name, "--", + base_cmd = ["lxc-attach", "-s", "NETWORK", + "-P", self.get_config_path(), "-n", self.name, "--", "ip"] # Get IPv6 -- 1.8.1.2 ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel