Skip to content

Commit

Permalink
v2v: Fix getExternalVMs if getting disk size failed
Browse files Browse the repository at this point in the history
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 <ian.fraser@asm.org.uk>
Bug-Url: https://bugzilla.redhat.com/1265556
Backport-to: 3.6
Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Reviewed-on: https://gerrit.ovirt.org/46540
Reviewed-by: Francesco Romani <fromani@redhat.com>
Continuous-Integration: Jenkins CI
  • Loading branch information
nirs authored and dankenigsberg committed Sep 25, 2015
1 parent f8127d8 commit fb4c72a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions vdsm/v2v.py
Expand Up @@ -689,9 +689,9 @@ def _add_disk_info(conn, disk):
_, 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):
Expand Down

0 comments on commit fb4c72a

Please sign in to comment.