Due to the new error messaging handling the function _vm_exists is not
necessary anymore and moved OperationFailed exception to get_vm function,
where makes more sence.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index f999ed0..14867e1 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -322,16 +322,6 @@ class VMModel(object):
xpath = "/domain/devices/disk[@device='disk']/source/@file"
return xmlutils.xpath_get_text(xml, xpath)
- def _vm_exists(self, name):
- try:
- self.get_vm(name, self.conn)
- return True
- except NotFoundError:
- return False
- except Exception, e:
- raise OperationFailed("KCHVM0009E", {'name': name,
- 'err': e.message})
-
@staticmethod
def get_vm(name, conn):
conn = conn.get()
@@ -342,7 +332,8 @@ class VMModel(object):
if e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN:
raise NotFoundError("KCHVM0002E", {'name': name})
else:
- raise
+ raise OperationFailed("KCHVM0009E", {'name': name,
+ 'err': e.message})
def delete(self, name):
conn = self.conn.get()
--
1.8.5.3