Quoting Stéphane Graber (stgra...@ubuntu.com): > On 02/11/2013 03:43 PM, Serge Hallyn wrote: > > > > 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. > > As we discussed on IRC, I think it'd be best to do two things: > 1) Add a new lxc.cgroup.directory option which would default to "lxc" > (our current directory) and let people easily override to another name > to avoid the conflict. > 2) Add a simple conflict checker in the cgroup code. If the cgroup path > already exists, then simply prefix -X to the directory name, > incrementing X as needed.
Sounds good. The main thing we'll need (in either case) is to have a lxc_cgroup_callback, analogous to lxc_pid_callback, in start.c which can return the name of a cgroup if asked by a new LXC_COMMAND_CGROUP_NAME. -serge ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel