[libvirt] [PATCH 08/13] Create + setup cgroups atomically for LXC process
Eric Blake
eblake at redhat.com
Tue Jul 23 18:35:28 UTC 2013
On 07/23/2013 09:21 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at 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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130723/6885fa15/attachment-0001.sig>
More information about the libvir-list
mailing list