Change in vdsm[master]: v2v: add try/except to get_external_vms

shavivi at redhat.com shavivi at redhat.com
Tue Dec 1 10:09:52 UTC 2015


Shahar Havivi has uploaded a new change for review.

Change subject: v2v: add try/except to get_external_vms
......................................................................

v2v: add try/except to get_external_vms

Single domain error causes get_external_vms to fail.

Bug-Url: https://bugzilla.redhat.com/1284412
Change-Id: Iec63dea83ec1805cf08d35be7c078edfd2f70966
Signed-off-by: Shahar Havivi <shaharh at redhat.com>
---
M vdsm/v2v.py
1 file changed, 20 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/07/49507/1

diff --git a/vdsm/v2v.py b/vdsm/v2v.py
index ab657d0..c227296 100644
--- a/vdsm/v2v.py
+++ b/vdsm/v2v.py
@@ -152,25 +152,28 @@
         vms = []
         for vm in conn.listAllDomains():
             params = {}
-            _add_vm_info(vm, params)
             try:
-                xml = vm.XMLDesc(0)
-            except libvirt.libvirtError as e:
-                logging.error("error getting domain xml for vm %r: %s",
-                              vm.name(), e)
-                continue
-            root = ET.fromstring(xml)
-            try:
-                _add_general_info(root, params)
+                _add_vm_info(vm, params)
+                try:
+                    xml = vm.XMLDesc(0)
+                except libvirt.libvirtError as e:
+                    logging.error("error getting domain xml for vm %r: %s",
+                                  vm.name(), e)
+                    continue
+                root = ET.fromstring(xml)
+                try:
+                    _add_general_info(root, params)
+                except InvalidVMConfiguration as e:
+                    logging.error('error parsing domain xml, msg: %s  xml: %s',
+                                  e.message, vm.XMLDesc(0))
+                    continue
+                _add_networks(root, params)
+                _add_disks(root, params)
+                for disk in params['disks']:
+                    _add_disk_info(conn, disk)
+                vms.append(params)
             except InvalidVMConfiguration as e:
-                logging.error('error parsing domain xml, msg: %s  xml: %s',
-                              e.message, vm.XMLDesc(0))
-                continue
-            _add_networks(root, params)
-            _add_disks(root, params)
-            for disk in params['disks']:
-                _add_disk_info(conn, disk)
-            vms.append(params)
+                logging.error('error parsing domain: %s', e)
         return {'status': doneCode, 'vmList': vms}
 
 


-- 
To view, visit https://gerrit.ovirt.org/49507
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec63dea83ec1805cf08d35be7c078edfd2f70966
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi at redhat.com>


More information about the vdsm-patches mailing list