Nir Soffer has uploaded a new change for review.

Change subject: v2v: Fix getExternalVMs if getting disk size failed
......................................................................

v2v: Fix getExternalVMs if getting disk size failed

In getExternalVMs we try to report the disk size, but if this info is
not available for certain disk, we continue to collect info about other
disks. Due to incorrect error handling, the request was aborted after
the first error:

      File "/usr/share/vdsm/v2v.py", line 684, in _add_disk_info
        disk['capacity'] = str(capacity)
    UnboundLocalError: local variable 'capacity' referenced before assignment

This patch fixes the error handling so failure to get disk size would
not fail the entire request.

Change-Id: I7e91190a255a4d9bd2f474e125c49b18e3d3bfd4
Reported-by: Ian Fraser <[email protected]>
Backport-to: 3.6
Signed-off-by: Nir Soffer <[email protected]>
---
M vdsm/v2v.py
1 file changed, 3 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/46540/1

diff --git a/vdsm/v2v.py b/vdsm/v2v.py
index 1b812d9..4c18daa 100644
--- a/vdsm/v2v.py
+++ b/vdsm/v2v.py
@@ -683,9 +683,9 @@
             _, capacity, alloc = vol.info()
         except libvirt.libvirtError:
             logging.exception("Error getting disk size")
-
-        disk['capacity'] = str(capacity)
-        disk['allocation'] = str(alloc)
+        else:
+            disk['capacity'] = str(capacity)
+            disk['allocation'] = str(alloc)
 
 
 def _add_disks(root, params):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e91190a255a4d9bd2f474e125c49b18e3d3bfd4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to