[libvirt] [PATCH] qemu: don't fail on destroy if domain is inactive

Peter Krempa pkrempa at redhat.com
Thu Mar 28 08:27:52 UTC 2019


On Thu, Mar 28, 2019 at 10:29:01 +0300, Nikolay Shirokovskiy wrote:
> Mgmt can not track if domain is already inactive before
> calling destroy because domain can become inactive because
> of crash/shutdown from guest. Thus it is make sense to

Well mgmt apps can use events emitted by libvirt precisely for this
case.

> report success in this case. Another option is to return
> special error code but this is a bit more complicated.
> 
> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
> ---
>  src/qemu/qemu_driver.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 62d8d97..0789efc 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -2172,8 +2172,10 @@ qemuDomainDestroyFlags(virDomainPtr dom,
>      if (virDomainDestroyFlagsEnsureACL(dom->conn, vm->def) < 0)
>          goto cleanup;
>  
> -    if (virDomainObjCheckActive(vm) < 0)
> +    if (!virDomainObjIsActive(vm)) {
> +        ret = 0;
>          goto cleanup;
> +    }

I'm not persuaded we want this. The commit message does not provide
enough means to justify it. Every other API we have returns error in
case when the domain is in the state the API will change it to so I'm
not in favor of making this api behave differently.

NACK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190328/aebeedf9/attachment-0001.sig>


More information about the libvir-list mailing list