]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/state.c
cgroup: improve support for multiple lxcpaths (v3)
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 1 Mar 2013 20:53:20 +0000 (14:53 -0600)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 4 Mar 2013 20:39:30 +0000 (14:39 -0600)
commitae5c8b8ed5feb9a47c5007c986ce01ea39b5075f
treefdd3d446b4d5e917b8a05ff2d6be678db6fa59ac
parent7f597314cdc6efe530f733e6caef6c6490af5ea2
cgroup: improve support for multiple lxcpaths (v3)

Add a monitor command to get the cgroup for a running container.  This
allows container r1 started from /var/lib/lxc and container r1 started
from /home/ubuntu/lxcbase to pick unique cgroup directories (which
will be /sys/fs/cgroup/$subsys/lxc/r1 and .../r1-1), and all the lxc-*
tools to get that path over the monitor at lxcpath.

Rework the cgroup code.  Before, if /sys/fs/cgroup/$subsys/lxc/r1
already existed, it would be moved to 'deadXXXXX', and a new r1 created.
Instead, if r1 exists, use r1-1, r1-2, etc.

I ended up removing both the use of cgroup.clone_children and support
for ns cgroup.  Presumably we'll want to put support for ns cgroup
back in for older kernels.  Instead of guessing whether or not we
have clone_children support, just always explicitly do the only thing
that feature buys us - set cpuset.{cpus,mems} for newly created cgroups.

Note that upstream kernel is working toward strict hierarchical
limit enforcements, which will be good for us.

NOTE - I am changing the lxc_answer struct size.  This means that
upgrades to this version while containers are running will result
in lxc_* commands on pre-running containers will fail.

Changelog: (v3)
   implement cgroup attach
   fix a subtle bug arising when we lxc_get_cgpath() returned
     STOPPED rather than -1 (STOPPED is 0, and 0 meant success).
   Rename some functions and add detailed comments above most.
   Drop all my lxc_attach changes in favor of those by Christian
     Seiler (which are mostly the same, but improved).

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
21 files changed:
src/lxc/attach.c
src/lxc/cgroup.c
src/lxc/cgroup.h
src/lxc/commands.c
src/lxc/commands.h
src/lxc/conf.c
src/lxc/conf.h
src/lxc/freezer.c
src/lxc/lxc.h
src/lxc/lxc_attach.c
src/lxc/lxc_cgroup.c
src/lxc/lxc_unshare.c
src/lxc/lxccontainer.c
src/lxc/lxcutmp.c
src/lxc/start.c
src/lxc/start.h
src/lxc/state.c
src/lxc/stop.c
src/tests/Makefile.am
src/tests/cgpath.c [new file with mode: 0644]
src/tests/lxcpath.c