Antoni Segura Puimedon has uploaded a new change for review. Change subject: Fix crash on vm start with netdevs some w/out info ......................................................................
Fix crash on vm start with netdevs some w/out info Some devices, like sr-iov do not have have information in the domxml to represent alias and name. This patch is a first version to get around the crash. It would maybe be preferrable to add support for some hook call in the except that would allow us to ask for the missing information to the hook (which could return something specific or default to the empty string, for example). Change-Id: I5a90fba21075ab2c7ecb0cb75f14ca07f090829e Signed-off-by: Antoni S. Puimedon <[email protected]> --- M vdsm/libvirtvm.py 1 file changed, 12 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/13540/1 diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py index cb792b5..2837b8f 100644 --- a/vdsm/libvirtvm.py +++ b/vdsm/libvirtvm.py @@ -2966,10 +2966,19 @@ getElementsByTagName('interface') for x in ifsxml: devType = x.getAttribute('type') - name = x.getElementsByTagName('target')[0].getAttribute('dev') + try: + name = x.getElementsByTagName('target')[0].getAttribute('dev') + except IndexError: + name = '' + try: + alias = x.getElementsByTagName('alias')[0].getAttribute('name') + except IndexError: + alias = '' + try: + model = x.getElementsByTagName('model')[0].getAttribute('type') + except IndexError: + model = '' mac = x.getElementsByTagName('mac')[0].getAttribute('address') - alias = x.getElementsByTagName('alias')[0].getAttribute('name') - model = x.getElementsByTagName('model')[0].getAttribute('type') network = None try: -- To view, visit http://gerrit.ovirt.org/13540 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5a90fba21075ab2c7ecb0cb75f14ca07f090829e Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
