[libvirt] [PATCH] Ignore qemu STOP event when stopping CPUs

Jiri Denemark jdenemar at redhat.com
Fri Apr 30 09:41:30 UTC 2010

> > > By setting vm->status to PAUSED before actually sending the request to
> > > qemu (and resetting it back if the request fails) we can ignore the
> > > event since the event handler does nothing when the guest is already
> > > paused. This solution is quite hacky but unfortunately it's the best
> > > solution which I was able to come up with and it doesn't introduce a
> > > race condition.
> > 
> >  You could extend the low-level driver to accept a mask of events to
> > be ignored.
> The core problem here is that QEMU only emits a STOP event, with no
> corresponding CONT event. If QEMU had been doing both, this patch
> would not be neccessary, because we'd see both transitions from QEMU
> instead of just one direction.

Actually, I don't think CONT event would help in this case. When libvirt is
issuing a command to stop qemu emulation, it knows if it failed or succeeded
synchronously and may set guest's state appropriately. Having asynchronously
processed handler of STOP/CONT event set the guest state is not a good idea.
We dealt with code written in such a way before and I guess no-one wants to
get back to it :-)

So I think we will eventually need to introduce event mask into monitor code.


More information about the libvir-list mailing list