[libvirt] [PATCH 1/2] qemu: make sure capability probing process can start

Richard W.M. Jones rjones at redhat.com
Sat Oct 11 14:24:49 UTC 2014


On Thu, Oct 09, 2014 at 10:14:48AM +0100, Daniel P. Berrange wrote:
> On Thu, Oct 09, 2014 at 09:58:30AM +0200, Martin Kletzander wrote:
> > When daemon is killed right in the middle of probing a qemu binary for
> > its capabilities, the VM is left running.  Next time the daemon is
> > starting, it cannot start qemu process because the one that's already
> > running does have the pidfile flock()'d.
> 
> I was wondering if there's anything we can easily change in the way
> we launch the QEMU binary so that it automatically dies when libvirtd
> exits, rather than us needing to manually kill it.

FWIW libguestfs (in non-libvirt mode) spawns off a recovery process
that is just there to kill qemu if the parent process goes away
without closing qemu properly.  This has Just Worked all the time we
have been using libguestfs.

Code:

https://github.com/libguestfs/libguestfs/blob/master/src/launch-direct.c#L746

> Another idea would be to play with adding '-serial stdio' and then
> when libvirt died stdio would get a broken pipe but I don't think
> it is safe to use -serial when we have -M none so that's out.

libguestfs uses -serial stdio but qemu doesn't die if the pipe is
broken.  Hence need for above.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the libvir-list mailing list