Change in vdsm[master]: v2v: refactor get_external_vms

shavivi at redhat.com shavivi at redhat.com
Mon Dec 14 12:55:29 UTC 2015


Shahar Havivi has posted comments on this change.

Change subject: v2v: refactor get_external_vms
......................................................................


Patch Set 3:

(3 comments)

https://gerrit.ovirt.org/#/c/49636/3/vdsm/v2v.py
File vdsm/v2v.py:

Line 641:     for vm in conn.listAllDomains():
Line 642:         yield vm
Line 643: 
Line 644: 
Line 645: def _add_vm(conn, vms, vm):
> Please convert this to early return style - do not create these nested try-
sure I waited to this patch to commit: 8279a89
now its the same style.
Line 646:     params = {}
Line 647:     try:
Line 648:         _add_vm_info(vm, params)
Line 649:         try:


Line 657:                 _add_general_info(root, params)
Line 658:             except InvalidVMConfiguration as e:
Line 659:                 logging.error('error parsing domain xml, msg: %s  xml: %s',
Line 660:                               e.message, vm.XMLDesc(0))
Line 661:             else:
> this is not just code move: the old code has "continue", now we have "else"
you are right,
I will do return here instead of continue to avoid adding the failing VM to the collection
Line 662:                 _add_networks(root, params)
Line 663:                 _add_disks(root, params)
Line 664:                 for disk in params['disks']:
Line 665:                     _add_disk_info(conn, disk)


Line 663:                 _add_disks(root, params)
Line 664:                 for disk in params['disks']:
Line 665:                     _add_disk_info(conn, disk)
Line 666:                 vms.append(params)
Line 667:     except libvirt.libvirtError as e:
> ...but I see also this new broad try/catch, which could be OK, but does not
NO, that was workaround until patch 8279a89 merged.
The next patch will fix it.
Line 668:         logging.error('error parsing domain: %s', e)
Line 669: 
Line 670: 
Line 671: def _add_vm_info(vm, params):


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

Gerrit-MessageType: comment
Gerrit-Change-Id: If5c331b3136b61b0ee81829d7e71eedbbc1fa6b9
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list