[Kimchi-devel] [PATCH 2/2] bugfix: Use correct error code when current snapshot does not exist

Crístian Viana vianac at linux.vnet.ibm.com
Tue Nov 18 20:03:19 UTC 2014


If a VM has no current snapshot, a NotFoundError is raised by the
backend. However, the error reason is 'KCHSNAP007E', which is invalid.

Use the correct error value (KCHSNAP0007E) when raising the exception
described above.

Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
---
 src/kimchi/model/vmsnapshots.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/kimchi/model/vmsnapshots.py b/src/kimchi/model/vmsnapshots.py
index e8e2294..ad8460e 100644
--- a/src/kimchi/model/vmsnapshots.py
+++ b/src/kimchi/model/vmsnapshots.py
@@ -177,7 +177,7 @@ class CurrentVMSnapshotModel(object):
             snap_name = vir_snap.getName().decode('utf-8')
         except libvirt.libvirtError, e:
             if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN_SNAPSHOT:
-                raise NotFoundError('KCHSNAP007E', {'vm': vm_name})
+                raise NotFoundError('KCHSNAP0007E', {'vm': vm_name})
 
             raise OperationFailed('KCHSNAP0008E',
                                   {'vm': vm_name, 'err': e.message})
-- 
1.9.3




More information about the Kimchi-devel mailing list