[libvirt] [PATCH] qemu: better detection of crashed domains

Eric Blake eblake at redhat.com
Wed Jun 6 15:22:59 UTC 2012


On 06/06/2012 09:03 AM, Martin Kletzander wrote:
> When libvirtd is started and there is an unusable/not-connectable
> leftover from earlier started machine, it's more reasonable to say
> that the machine "crashed" if we know it was started with
> "-no-shutdown".
> This patch fixes that and also changes the other result (when machine
> was started without "-no-shutdown") to "unknown", because the previous
> "failed" reason means (according to include/libvirt/libvirt.h.in:174),
> that the machine failed to start.
> ---
>  src/qemu/qemu_process.c |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
> index 2adf570..604c31b 100644
> --- a/src/qemu/qemu_process.c
> +++ b/src/qemu/qemu_process.c
> @@ -3141,7 +3141,17 @@ error:
>               * to remove danger of it ending up running twice if
>               * user tries to start it again later
>               */
> -            qemuProcessStop(driver, obj, 0, VIR_DOMAIN_SHUTOFF_FAILED);
> +            if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN))
> +                /* If we couldn't get the monitor and qemu supports
> +                 * no-shutdown, we can safely say that the domain
> +                 * crashed ... */
> +                state = VIR_DOMAIN_SHUTOFF_CRASHED;
> +            else

Style nit - since you have lengthy comments, each branch now occupies
multiple lines (even if it is only one statement); I would use {} on
both the if and else branches for that reason.

ACK.

-- 
Eric Blake   eblake at 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: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120606/8508fb30/attachment-0001.sig>


More information about the libvir-list mailing list