]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/start.c
pass lxcpath to lxc_command
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 11 Feb 2013 20:43:41 +0000 (14:43 -0600)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 11 Feb 2013 21:42:49 +0000 (16:42 -0500)
commit13f5be6276100761eaeddd77b7b55fbec6b0c9ab
treed4c1e4ad72fa14ca43b014f68c6d3d158f8d3108
parentedb09f8d1bb822c4f23d745ae8117bf084e1d12c
pass lxcpath to lxc_command

The previous lxcpath patches added support for a custom LXCPATH set
through a system-wide configuration file.

This was also exposed through the C api, so that a custom lxcpath could
be set at the container object instanciation time, or set at runtime.

However the command sock filename was always located under the global
lxcpath, which could be confusing, and would be a problem for users
with insufficient perms to the system-wide lxc path (i.e. if setting
lxcpath to $HOME/lxcbase).  This patch changes that by passing the
lxcpath to all callers of lxc_command().

It remains to add an lxcpath command line argument to most of the
command line tools (which are not using the C api) - lxc-start,
lxc-info, lxc-stop, etc.

At this point it becomes tempting to do something like

c = lxc.Container("r1", "/var/lib/lxc")
c2 = lxc.Container("r1", "$HOME/lxcbase")

However, that's problematic - those two will use the same directory
names for cgroup directories.

What would be the best way to handle this?  One way (which I kind
of like) is to give up on naming the cgroups after the container.
use mkstemp for the cgroup name, let lxc keep track of the cgroup
name based on the command socket, and make users use lxc-cgroup to get
and change settings.

Other ideas?

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
19 files changed:
src/lxc/commands.c
src/lxc/commands.h
src/lxc/console.c
src/lxc/execute.c
src/lxc/lxc.h
src/lxc/lxc_attach.c
src/lxc/lxc_console.c
src/lxc/lxc_execute.c
src/lxc/lxc_info.c
src/lxc/lxc_kill.c
src/lxc/lxc_start.c
src/lxc/lxc_stop.c
src/lxc/lxccontainer.c
src/lxc/restart.c
src/lxc/start.c
src/lxc/start.h
src/lxc/state.c
src/lxc/state.h
src/lxc/stop.c