[libvirt] [PATCH] Test driver should error when domain destroy twice

Michal Privoznik mprivozn at redhat.com
Tue Nov 8 08:48:39 UTC 2016


On 07.11.2016 21:09, Félix Bouliane wrote:
> Fixes the behavior when destroying a domain more than once.
> VIR_ERR_OPERATION_INVALID should be raised when destroying an
> already destroyed domain.
> ---
>  src/test/test_driver.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 51fb7c8..42adbad 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -1735,6 +1735,12 @@ static int testDomainDestroy(virDomainPtr domain)
>      if (!(privdom = testDomObjFromDomain(domain)))
>          goto cleanup;
>  
> +    if (!virDomainObjIsActive(privdom)) {
> +        virReportError(VIR_ERR_OPERATION_INVALID,
> +                       "%s", _("domain is not running"));
> +        goto cleanup;
> +    }
> +
>      testDomainShutdownState(domain, privdom, VIR_DOMAIN_SHUTOFF_DESTROYED);
>      event = virDomainEventLifecycleNewFromObj(privdom,
>                                       VIR_DOMAIN_EVENT_STOPPED,
> 

Nice catch.

ACKed and pushed.

Congratulations on your first libvirt contribution.

Michal




More information about the libvir-list mailing list