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,