[lxc-devel] [PATCHv3 05/14] cgroup: additional fix for deprecated ns subsystem

2012-03-21 Thread David Ward
When a hierarchy contains the 'ns' subsystem, do not append '/lxc' to the parent cgroup. Update surrounding comments for consistency. Signed-off-by: David Ward --- src/lxc/cgroup.c | 13 +++-- 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lxc/cgroup.c b/src/lxc/cgr

[lxc-devel] [PATCHv3 12/14] rewrite lxc-ps

2012-03-21 Thread David Ward
Use bash instead of perl; eliminates final lxc dependency on perl (beneficial for minimal operating system environments). Modify the cgroup search to only use hierarchies that contain one or more subsystems. When searching, if a hierarchy contains the 'ns' subsystem, do not append '/lxc' to the pa

[lxc-devel] [PATCHv3 03/14] utmp: do not set conf->need_utmp_watch if CAP_SYS_BOOT is not found

2012-03-21 Thread David Ward
If CAP_SYS_BOOT is not found in the kernel, the existing value for conf->need_utmp_watch should be left intact (which will be '1' for containers started with 'lxc-start', or '0' for containers started with 'lxc-execute'). Signed-off-by: David Ward --- src/lxc/start.c |3 +-- 1 files changed,

[lxc-devel] [PATCHv3 06/14] lxc-cgroup: use correct terminology

2012-03-21 Thread David Ward
lxc-cgroup gets or sets the value of a state object (such as 'cpuset.cpus'), not the value of a subsystem (which would be just 'cpuset'). Signed-off-by: David Ward --- doc/lxc-cgroup.sgml.in | 31 +-- src/lxc/cgroup.c |4 ++-- src/lxc/lxc_cgroup.c | 22

[lxc-devel] [PATCHv3 09/14] cgroup: only touch hierarchies that are bound to subsystems

2012-03-21 Thread David Ward
Obtain a list of subsystems from /proc/cgroups, and ignore hierarchies that are not bound to any of them (especially the 'systemd' hierarchy: http://www.freedesktop.org/wiki/Software/systemd/PaxControlGroups ). Signed-off-by: David Ward --- src/lxc/cgroup.c | 50 +++

[lxc-devel] [PATCHv3 02/14] lxc-attach: use execvp instead of execve

2012-03-21 Thread David Ward
execvp does not require specifying the full path to the executable (e.g., "ls" instead of "/bin/ls"), making the operation of 'lxc-attach' consistent with 'lxc-start' and 'lxc-execute'. Signed-off-by: David Ward --- src/lxc/lxc_attach.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletion

[lxc-devel] [PATCHv3 01/14] use syscall numbers from Linux kernel headers

2012-03-21 Thread David Ward
__NR_setns is defined in the Linux kernel headers in linux/unistd.h. The full Linux kernel sources are not necessary for compilation. Signed-off-by: David Ward --- config/linux.m4 | 76 --- configure.ac|8 ++--- src/lxc/Makefile.a

[lxc-devel] [PATCHv3 10/14] refresh lxc-ls

2012-03-21 Thread David Ward
Add an '--active' option that lists active containers by searching cgroups. (Otherwise, the directories in /var/lib/lxc are listed.) Modify the cgroup search to only use hierarchies that contain one or more subsystems. When searching, if a hierarchy contains the 'ns' subsystem, do not append '/lxc'

[lxc-devel] [PATCHv3 00/14] Assorted fixes against lxc 0.8.0-rc2

2012-03-21 Thread David Ward
v3: Rebase onto 0.8.0-rc2; add cgroup fixes to handle ns subsystem; fix terminology in lxc-cgroup v2: Add changes to scripts (including new '--active' flag for lxc-ls) The following patches address a number of different issues I discovered while building or using lxc (these are not feature pat

[lxc-devel] [PATCHv3 08/14] lxc-attach: unify code for attaching a pid to a cgroup

2012-03-21 Thread David Ward
To attach a new pid to the cgroups for an existing container, we can use the same method that we did when we started the container: iterate over all the mounted cgroup hierarchies; find the cgroup that pid 1 is in for each hierarchy; add 'lxc/' to the end of it; then write the pid to the 'tasks' fi

[lxc-devel] [PATCHv3 11/14] refresh lxc-netstat

2012-03-21 Thread David Ward
Modify the cgroup search to only use hierarchies that contain one or more subsystems. When searching, if a hierarchy contains the 'ns' subsystem, do not append '/lxc' to the parent cgroup. Change method of bind mounting /proc//net onto /proc/net, to avoid error "cannot mount block device /proc//ne

[lxc-devel] [PATCHv3 04/14] utmp: support non-rootfs configuration

2012-03-21 Thread David Ward
Having a rootfs is not a necessary condition for monitoring utmp, since /var or /var/run can just be remounted inside the container instead. We should rely on the other two conditions already in place to decide whether to monitor the utmp file: - the container was started with 'lxc-start', which

[lxc-devel] [PATCHv3 07/14] cgroup: rearrange code blocks

2012-03-21 Thread David Ward
Avoid nesting and improve readability. Signed-off-by: David Ward --- src/lxc/cgroup.c | 70 - 1 files changed, 32 insertions(+), 38 deletions(-) diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c index f50c74a..8d70951 100644 --- a/src/lxc/cgr

[lxc-devel] [PATCHv3 13/14] make help consistent for other scripts

2012-03-21 Thread David Ward
Display help information in a consistent format. Print error messages and help information to stderr. Prefix error messages with the name of the script (for easier debugging as part of larger scripts). Allow help information to be printed as a non-root user. Fix file mode for lxc-checkconfig.in.

[lxc-devel] [PATCHv3 14/14] lxc-setcap/lxc-setuid: add autoconf expansion for $libexecdir

2012-03-21 Thread David Ward
Support new default location for LXCINITDIR. Signed-off-by: David Ward --- configure.ac |1 + src/lxc/lxc-setcap.in |1 + src/lxc/lxc-setuid.in |1 + 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index c2bf4b0..0c8aa69 100644 ---