Ido Barkan has posted comments on this change.
Change subject: netinfo: improve which ipv4 addr is reported.
......................................................................
Patch Set 7:
(2 comments)
https://gerrit.ovirt.org/#/c/33375/7/lib/vdsm/netinfo.py
File lib/vdsm/netinfo.py:
Line 340: address_cidr = addr['address'] # x.y.z.t/N
Line 341: if addr['family'] == 'inet':
Line 342: ipv4addrs.append(address_cidr)
Line 343: if is_primary(addr):
Line 344: address, prefix = address_cidr.split('/')
the [0] was intentional, please do not drop it
good one.
Line 345: if ipv4_gateway and ipv4addr == '':
Line 346: addr_net = IPNetwork(address_cidr)
Line 347: gw_net = IPNetwork(ipv4_gateway + '/' + prefix)
Line 348: if addr_net in gw_net:
https://gerrit.ovirt.org/#/c/33375/7/tests/netinfoTests.py
File tests/netinfoTests.py:
Line 338: self.assertEqual(gateway, '12.34.56.1')
Line 339:
Line 340: @ValidateRunningAsRoot
Line 341: def test_ip_info(self):
Line 342: IP_ADDR = '192.168.1.9'
TEST range should be used here, too.
Done
Line 343: NET_MASK = '255.255.255.0'
Line 344: PREFIX_LENGTH = 24
Line 345: with dummy.device() as dummy_name:
Line 346: ipwrapper.addrAdd(dummy_name, IP_ADDR, PREFIX_LENGTH)
--
To view, visit
https://gerrit.ovirt.org/33375
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I8666cfef5bd8ea63edf8979e501d4785db5f4893
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <toni+ovirt(a)midokura.com>
Gerrit-Reviewer: Antoni Segura Puimedon <toni+ovirt(a)midokura.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan(a)redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Petr Horáček <phoracek(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-HasComments: Yes