[libvirt] [PATCH v2 9/9] qemu: Update domain state when reconnecting monitor
Eric Blake
eblake at redhat.com
Fri May 13 23:00:33 UTC 2011
On 05/10/2011 07:39 AM, Jiri Denemark wrote:
> A qemu domain can get paused when libvirtd is stopped (e.g., because of
> I/O error) so we should check its current state when reconnecting to it.
> ---
> Notes:
> Version 2:
> - new patch
Good catch. I see danpb reviewed the rest of the series, but missed
this one.
> +++ b/src/qemu/qemu_process.c
> @@ -1881,6 +1881,37 @@ qemuProcessFiltersInstantiate(virConnectPtr conn,
> return err;
> }
>
> +static int
> +qemuProcessUpdateState(struct qemud_driver *driver, virDomainObjPtr vm)
> +{
> + qemuDomainObjPrivatePtr priv = vm->privateData;
> + virDomainState state;
> + bool running;
> + int ret;
> +
> + qemuDomainObjEnterMonitorWithDriver(driver, vm);
> + ret = qemuMonitorGetStatus(priv->mon, &running);
> + qemuDomainObjExitMonitorWithDriver(driver, vm);
> +
> + if (ret < 0 || !virDomainObjIsActive(vm))
> + return -1;
I half debated about whether virDomainObjIsActive returning fals can
still successfully result in a state update; but I convinced myself that
this is tied to a qemu process, and if the process goes away, then
elsewhere in the code correctly changes the state, and that this only
needs to probe the monitor for a live qemu process.
ACK.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110513/6bd7f1b7/attachment-0001.sig>
More information about the libvir-list
mailing list