[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v2 9/9] qemu: Update domain state when reconnecting monitor



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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]