Change in vdsm[master]: netinfo: get an interface using one of IP addresses assgined...
mhuntxu at gmail.com
mhuntxu at gmail.com
Wed Jun 5 11:10:07 UTC 2013
Hunt Xu has posted comments on this change.
Change subject: netinfo: get an interface using one of IP addresses assgined to it
......................................................................
Patch Set 4: I would prefer that you didn't submit this
(3 inline comments)
patch set 5 is going to clear this -1.
....................................................
File lib/vdsm/netinfo.py
Line 481: """Return an IPv6 IPv4-mapped address for the IPv4 address"""
Line 482: mapped = None
Line 483:
Line 484: try:
Line 485: ipv4num = struct.unpack('>I', socket.inet_pton(socket.AF_INET, ip))[0]
Firstly, yes! :-)
For simplicity's sake I prefer to use
ipBin = '\x00' * 10 + '\xff\xff' + socket.inet_aton(ip)
Line 486: ipv6num = ipv4num | (0xffff << 32)
Line 487: ipv6struct = struct.pack('>QQ', *divmod(ipv6num, 2 ** 64))
Line 488: mapped = socket.inet_ntop(socket.AF_INET6, ipv6struct)
Line 489: except socket.error as e:
Line 500: # also match a IPv4-mapped IPv6 address
Line 501: ipaddrs.append(IPv4toMapped(ipaddrs[-1]))
Line 502: if ip in ipaddrs:
Line 503: return dev.device
Line 504: return ''
As the addresses provided are well-formed. I'd like to keep using strings since that reduces conversions.
Line 505:
Line 506:
Line 507: class NetInfo(object):
Line 508: def __init__(self, _netinfo=None):
....................................................
File tests/capsTests.py
Line 93
Line 94
Line 95
Line 96
Line 97
Yes, I moved the test to netinfoTests.py.
--
To view, visit http://gerrit.ovirt.org/11519
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I239f92c527524e5651f51712841c3eafcf659e53
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Hunt Xu <mhuntxu at gmail.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Assaf Muller <amuller at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Hunt Xu <mhuntxu at gmail.com>
Gerrit-Reviewer: Igor Lvovsky <ilvovsky at redhat.com>
Gerrit-Reviewer: Livnat Peer <lpeer at redhat.com>
Gerrit-Reviewer: Mark Wu <wudxw at linux.vnet.ibm.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
More information about the vdsm-patches
mailing list