From: Félix Bouliane Date: Mon, 7 Nov 2016 20:09:26 +0000 (-0500) Subject: test driver: error out when domain destroy twice X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=27a37f1670248bb913c5974149dd17eae5e08701;p=libvirt.git test driver: error out when domain destroy twice Fixes the behavior when destroying a domain more than once. VIR_ERR_OPERATION_INVALID should be raised when destroying an already destroyed domain. Signed-off-by: Michal Privoznik --- diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 51fb7c8f3f..c5e1a4591d 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1731,10 +1731,15 @@ static int testDomainDestroy(virDomainPtr domain) virObjectEventPtr event = NULL; int ret = -1; - 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,