From aa4679ce01901d57dc6a57dac42aa6b466bc6dbf Mon Sep 17 00:00:00 2001 From: Dennis Dmitriev Date: Mon, 6 Feb 2017 16:12:57 +0200 Subject: [PATCH] Fix unit tests for libvirt 2.5+ In libvirt v2.5+, domain.destroy() raises an error in unit tests: "Requested operation is not valid: domain is not running" - check if the domain is active in the unit tests. Change-Id: I92420699738ea3e5ece4e9137ac797fbcbc015ea Related-bug:#1641568 --- devops/tests/driver/libvirt/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/devops/tests/driver/libvirt/base.py b/devops/tests/driver/libvirt/base.py index 82f15d75..1a52cdad 100644 --- a/devops/tests/driver/libvirt/base.py +++ b/devops/tests/driver/libvirt/base.py @@ -123,7 +123,8 @@ class LibvirtTestCase(TestCase): for domain in conn.listAllDomains(): for snapshot in domain.listAllSnapshots(0): snapshot.delete() - domain.destroy() + if domain.isActive(): + domain.destroy() domain.undefine() for network in conn.listAllNetworks(): network.destroy()