[Kimchi-devel] [PATCH] Remove workaround when deleting a VM due to tests

Crístian Viana vianac at linux.vnet.ibm.com
Thu Jan 22 14:09:46 UTC 2015


Old versions of tests used libvirt's Test driver directly and some
functions didn't work with it. In those cases, we needed a workaround so
those functions were able to work with the real model and the test model.
However, that's not the case anymore because we overwrite the functions
which don't make sense in a test environment. so some workarounds aren't
needed anymore.

When deleting a VM, do not handle an exception which we only expect when
running Kimchi on libvirt's Test driver. The current code uses an
overwritten, custom function which makes the workaround obsolete.

Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
---
 src/kimchi/model/vms.py | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index bae27c1..c3a6a0d 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -792,18 +792,9 @@ class VMModel(object):
             self.poweroff(name)
 
         # delete existing snapshots before deleting VM
-
-        # libvirt's Test driver does not support the function
-        # "virDomainListAllSnapshots", so "VMSnapshots.get_list" will raise
-        # "OperationFailed" in that case.
-        try:
-            snapshot_names = self.vmsnapshots.get_list(name)
-        except OperationFailed, e:
-            kimchi_log.error('cannot list snapshots: %s; '
-                             'skipping snapshot deleting...' % e.message)
-        else:
-            for s in snapshot_names:
-                self.vmsnapshot.delete(name, s)
+        snapshot_names = self.vmsnapshots.get_list(name)
+        for s in snapshot_names:
+            self.vmsnapshot.delete(name, s)
 
         try:
             dom.undefine()
-- 
2.1.0




More information about the Kimchi-devel mailing list