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
This commit is contained in:
Dennis Dmitriev 2017-02-06 16:12:57 +02:00
parent 8b65d9184f
commit aa4679ce01
1 changed files with 2 additions and 1 deletions

View File

@ -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()