
On 07/23/2013 09:21 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Currently the LXC driver creates the VM's cgroup prior to forking, and then libvirt_lxc moves the child process into the cgroup. This won't work with systemd whose APIs do the creation of cgroups + attachment of processes atomically.
Fortunately we simply move the entire of cgroups setup into
s/of//
the libvirt_lxc child process. We make it take place before fork'ing into the background, so by the time virCommandRun returns in the LXC driver, the cgroup is guaranteed to be present.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- src/lxc/lxc_controller.c | 19 ++++++++++--------- src/lxc/lxc_process.c | 40 +++++++++++++++++++++++++++------------- 2 files changed, 37 insertions(+), 22 deletions(-)
+++ b/src/lxc/lxc_process.c @@ -49,6 +49,7 @@ #include "virhook.h" #include "virstring.h" #include "viratomic.h" +#include "virprocess.h"
#define VIR_FROM_THIS VIR_FROM_LXC
@@ -701,9 +702,9 @@ int virLXCProcessStop(virLXCDriverPtr driver, return -1; } } else { - /* If cgroup doesn't exist, the VM pids must have already - * died and so we're just cleaning up stale state - */ + /* If cgroup doesn't exist, just try cleaning up th
s/th/the/ ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org