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

Félix Bouliane felixbouliane at gmail.com
Mon Nov 7 20:09:26 UTC 2016


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,
-- 
2.9.3




More information about the libvir-list mailing list