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.

Change-Id: I8ecd222dc3805a084be62f05260c80e16d61b8e0
Signed-off-by: Shahar Havivi <shah...@redhat.com>
---
M vdsm/v2v.py
1 file changed, 20 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/49557/1

diff --git a/vdsm/v2v.py b/vdsm/v2v.py
index ab657d0..fc5528c 100644
--- a/vdsm/v2v.py
+++ b/vdsm/v2v.py
@@ -152,22 +152,38 @@
         vms = []
         for vm in conn.listAllDomains():
             params = {}
-            _add_vm_info(vm, params)
+            try:
+                _add_vm_info(vm, params)
+            except libvirt.libvirtError as e:
+                logging.error("error getting domain infomation: %s", e)
+                continue
             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:
+                root = ET.fromstring(xml)
+            except ET.ParseError as e:
+                logging.error('error parsing domain xml: %s', e)
+                continue
             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)
+            try:
+                _add_networks(root, params)
+            except libvirt.libvirtError as e:
+                logging.error('error reading network configuration: %s', e)
+                continue
+            try:
+                _add_disks(root, params)
+            except libvirt.libvirtError as e:
+                logging.error('error reading disks configuration: %s', e)
+                continue
             for disk in params['disks']:
                 _add_disk_info(conn, disk)
             vms.append(params)


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8ecd222dc3805a084be62f05260c80e16d61b8e0
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shav...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to