[PATCH] Test driver should error when domain destroy twice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]