[lxc-devel] symbolic link for /var/lib/lxc
Serge Hallyn
serge.hallyn at ubuntu.com
Wed Jul 22 20:55:04 UTC 2015
Quoting Harald Dunkel (harald.dunkel at aixigo.de):
> Hi folks,
>
> please consider this:
>
> # ls -al /var/lib/lxc
> lrwxrwxrwx 1 root root 11 Aug 11 2014 /var/lib/lxc -> /export/lxc
>
> # lxc-ls --fancy
> NAME STATE IPV4 IPV6 GROUPS AUTOSTART
> -------------------------------------------------------------
> lxchost01 RUNNING 10.123.96.134 - auto BY-GROUP
> lxchost02 RUNNING 10.123.99.37 - auto BY-GROUP
> lxchost03 RUNNING 10.123.96.51 - auto BY-GROUP
> lxchost04 STOPPED - - auto NO
> lxchost05 RUNNING 10.123.96.46 - auto BY-GROUP
> lxchost06 RUNNING 10.123.96.55 - auto BY-GROUP
> lxchost07 RUNNING 10.123.99.219 - auto BY-GROUP
> lxchost08 RUNNING 10.123.96.53 - auto BY-GROUP
> lxchost09 RUNNING 10.123.96.76 - auto BY-GROUP
> lxchost10 RUNNING 10.123.99.216 - auto BY-GROUP
> lxchost11 RUNNING 10.123.99.125 - auto BY-GROUP
> lxchost12 STOPPED - - - NO
>
> # lxc-ls -P /export/lxc --fancy
> NAME STATE IPV4 IPV6 GROUPS AUTOSTART
> ----------------------------------------------------
> lxchost01 STOPPED - - auto BY-GROUP
> lxchost02 STOPPED - - auto BY-GROUP
> lxchost03 STOPPED - - auto BY-GROUP
> lxchost04 STOPPED - - auto NO
> lxchost05 STOPPED - - auto BY-GROUP
> lxchost06 STOPPED - - auto BY-GROUP
> lxchost07 STOPPED - - auto BY-GROUP
> lxchost08 STOPPED - - auto BY-GROUP
> lxchost09 STOPPED - - auto BY-GROUP
> lxchost10 STOPPED - - auto BY-GROUP
> lxchost11 STOPPED - - auto BY-GROUP
> lxchost12 STOPPED - - - NO
>
>
> This looks pretty fragile to me. Shouldn't lxc report the same
> state for both paths, no matter what?
No, because when you start the container, it listens on a
abstract unix socket, i.e. @/var/lib/lxc/rootw1/command, for
things like 'what is your init pid'. The lxcpath is a part of
that path. So when you callously do lxc-ls using a different
lxcpath than you used for lxc-start, you end up looking for
a command socket which doesn't exist.
Since a container named 'lxchost01' could exist and be running
in 5 different lxcpaths at the same time, we can't really avoid
this. (that is, it has to be the case that the lxcpath matters)
-serge
More information about the lxc-devel
mailing list