]> xenbits.xensource.com Git - libvirt.git/commit
lxc: don't try to hide parent cgroups inside container
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 22 Jan 2016 16:07:18 +0000 (16:07 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 26 Jan 2016 16:11:32 +0000 (16:11 +0000)
commitdc576025c360a1d2c89da410d0f3f0da55d0143f
tree458bc31996f3530b25c58529a1d95081fc53ee93
parent511e7c5bbaed475bd68982a6926834e27ee3841a
lxc: don't try to hide parent cgroups inside container

On the host when we start a container, it will be
placed in a cgroup path of

   /machine.slice/machine-lxc\x2ddemo.scope

under /sys/fs/cgroup/*

Inside the containers' namespace we need to setup
/sys/fs/cgroup mounts, and currently will bind
mount /machine.slice/machine-lxc\x2ddemo.scope on
the host to appear as / in the container.

While this may sound nice, it confuses applications
dealing with cgroups, because /proc/$PID/cgroup
now does not match the directory in /sys/fs/cgroup

This particularly causes problems for systems and
will make it create repeated path components in
the cgroup for apps run in the container eg

  /machine.slice/machine-lxc\x2ddemo.scope/machine.slice/machine-lxc\x2ddemo.scope/user.slice/user-0.slice/session-61.scope

This also causes any systemd service that uses
sd-notify to fail to start, because when systemd
receives the notification it won't be able to
identify the corresponding unit it came from.
In particular this break rabbitmq-server startup

Future kernels will provide proper cgroup namespacing
which will handle this problem, but until that time
we should not try to play games with hiding parent
cgroups.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/libvirt_private.syms
src/lxc/lxc_container.c
src/util/vircgroup.c
src/util/vircgroup.h