Please ignore these patches
On 04/28/2015 10:16 AM, Ramon Medeiros wrote:
Remove duplicated code of conn.lookupByName.
Signed-off-by: Ramon Medeiros <ramonn(a)linux.vnet.ibm.com>
---
src/kimchi/model/vms.py | 2 +-
src/kimchi/model/vmstorages.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
index 6792447..87d63c1 100644
--- a/src/kimchi/model/vms.py
+++ b/src/kimchi/model/vms.py
@@ -266,7 +266,7 @@ class VMModel(object):
# fetch base XML
cb('reading source VM XML')
try:
- vir_dom = vir_conn.lookupByName(name)
+ vir_dom = self.get_vm(name)
flags = libvirt.VIR_DOMAIN_XML_SECURE
xml = vir_dom.XMLDesc(flags).decode('utf-8')
except libvirt.libvirtError, e:
diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
index 37aca64..8dabae7 100644
--- a/src/kimchi/model/vmstorages.py
+++ b/src/kimchi/model/vmstorages.py
@@ -138,7 +138,7 @@ class VMStoragesModel(object):
dev, xml = get_disk_xml(params)
try:
conn = self.conn.get()
- dom = conn.lookupByName(vm_name)
+ dom = VMModel.get_vm(vm_name, conn)
dom.attachDeviceFlags(xml, get_vm_config_flag(dom, 'all'))
except Exception as e:
raise OperationFailed("KCHVMSTOR0008E", {'error':
e.message})
@@ -173,7 +173,7 @@ class VMStorageModel(object):
try:
bus_type = self.lookup(vm_name, dev_name)['bus']
- dom = conn.lookupByName(vm_name)
+ dom = VMModel.get_vm(vm_name, conn)
except NotFoundError:
raise
--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
ramonn(a)br.ibm.com