Antoni Segura Puimedon has uploaded a new change for review.
Change subject: netinfo: fix defaultdict regression ......................................................................
netinfo: fix defaultdict regression
netinfo.get is supposed to retun a map containing the keys: - bondings - bridges - networks - nics - vlans
The change http://gerrit.ovirt.org/#/c/21652/5/lib/vdsm/netinfo.py replaced the dictionary initialization to 'networks': {} (and assignment of the other keys to a dict that could be empty) with a defaultdict.
Unfortunately since not always are there gonna be elements for each of the keys that get() is supposed to return, get() could end up reporting only 'nics', creating all sorts of havoc in caps.py and any get() consumer. (It failed the unit tests on machines without vdsm networks defined).
Change-Id: I5c59eea34f7ad7f28428292f064698d1d04cbdb5 Signed-off-by: Antoni S. Puimedon asegurap@redhat.com --- M lib/vdsm/netinfo.py 1 file changed, 3 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/50/21850/1
diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py index da01905..edc1c13 100644 --- a/lib/vdsm/netinfo.py +++ b/lib/vdsm/netinfo.py @@ -18,7 +18,7 @@ # Refer to the README and COPYING files for full details of the license #
-from collections import namedtuple, defaultdict +from collections import namedtuple import errno from glob import iglob from itertools import chain @@ -528,7 +528,8 @@
def get(): - d = defaultdict(dict) + d = {'bondings': {}, 'bridges': {}, 'networks': {}, 'nics': {}, + 'vlans': {}} gateways = getRoutes() ipv6routes = getIPv6Routes() paddr = permAddr()
oVirt Jenkins CI Server has posted comments on this change.
Change subject: netinfo: fix defaultdict regression ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/4980/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5780/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/5870/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_network_functional_tests/915/ : SUCCESS
Antoni Segura Puimedon has posted comments on this change.
Change subject: netinfo: fix defaultdict regression ......................................................................
Patch Set 1: Verified+1
Assaf Muller has posted comments on this change.
Change subject: netinfo: fix defaultdict regression ......................................................................
Patch Set 1:
I did test the offending patch on a machine with no networks (Remember I had trouble with libvirt and removing ovirtmgmt?). Are you sure the regression is that simple?
Assaf Muller has posted comments on this change.
Change subject: netinfo: fix defaultdict regression ......................................................................
Patch Set 1: Code-Review+1
Investigated into it and talked to Toni. I took a lot of time to get a host running with no networks to test it and I swear getVdsCaps worked fine. I guess I missed it somehow!
Dan Kenigsberg has submitted this change and it was merged.
Change subject: netinfo: fix defaultdict regression ......................................................................
netinfo: fix defaultdict regression
netinfo.get is supposed to retun a map containing the keys: - bondings - bridges - networks - nics - vlans
The change http://gerrit.ovirt.org/#/c/21652/5/lib/vdsm/netinfo.py replaced the dictionary initialization to 'networks': {} (and assignment of the other keys to a dict that could be empty) with a defaultdict.
Unfortunately since not always are there gonna be elements for each of the keys that get() is supposed to return, get() could end up reporting only 'nics', creating all sorts of havoc in caps.py and any get() consumer. (It failed the unit tests on machines without vdsm networks defined).
Change-Id: I5c59eea34f7ad7f28428292f064698d1d04cbdb5 Signed-off-by: Antoni S. Puimedon asegurap@redhat.com Reviewed-on: http://gerrit.ovirt.org/21850 Reviewed-by: Assaf Muller amuller@redhat.com Reviewed-by: Dan Kenigsberg danken@redhat.com --- M lib/vdsm/netinfo.py 1 file changed, 3 insertions(+), 2 deletions(-)
Approvals: Antoni Segura Puimedon: Verified Assaf Muller: Looks good to me, but someone else must approve Dan Kenigsberg: Looks good to me, approved
Dan Kenigsberg has posted comments on this change.
Change subject: netinfo: fix defaultdict regression ......................................................................
Patch Set 1: Code-Review+2
I'm taking the quick fix, but you owe me a unit test that would have exposed the bug.
vdsm-patches@lists.fedorahosted.org