Martin Polednik has uploaded a new change for review. Change subject: vdsm: refactor has_channel ......................................................................
vdsm: refactor has_channel has_channel contains unnecessary "sanity check" for domain xml. The function should expect valid XML and if check is required, it should exist elsewhere. Change-Id: I0b287a1db2252a5d9afc83cfa25b96ed1c2a02d2 Signed-off-by: Martin Polednik <[email protected]> --- M vdsm/virt/vmxml.py 1 file changed, 6 insertions(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/32449/1 diff --git a/vdsm/virt/vmxml.py b/vdsm/virt/vmxml.py index 4171c5c..c94fef5 100644 --- a/vdsm/virt/vmxml.py +++ b/vdsm/virt/vmxml.py @@ -32,14 +32,13 @@ def has_channel(domXML, name): domObj = etree.fromstring(domXML) - devices = domObj.findall('devices') + devices = domObj.find('devices') - if len(devices) == 1: - for chan in devices[0].findall('channel'): - targets = chan.findall('target') - if len(targets) == 1: - if targets[0].attrib['name'] == name: - return True + for channel in devices.findall('channel'): + targets = channel.findall('target') + if len(targets) == 1: + if targets[0].attrib['name'] == name: + return True return False -- To view, visit http://gerrit.ovirt.org/32449 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0b287a1db2252a5d9afc83cfa25b96ed1c2a02d2 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Polednik <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
