Hunt Xu has posted comments on this change.

Change subject: netinfo: implement functions gathering ipv6 information
......................................................................


Patch Set 1: I would prefer that you didn't submit this

(4 inline comments)

Would update when I finish the mentioned unit test. Comments are welcome.

....................................................
File vdsm/netinfo.py
Line 180:     return bitmask_to_address(netmask)
Line 181: 
Line 182: 
Line 183: def getipv6addrs(dev):
Line 184:     """Return a list of ipv6 addresses in the format of 
'address/prefixlen'."""
I think ipv6 address indicates its scope, from the ietf rfc. And it seems we 
don't that care ipv4 addresses' scope, isn't it the same?
Line 185:     dev_info_list = ethtool.get_interfaces_info(dev.encode('utf8'))
Line 186:     ipv6addrs = dev_info_list[0].get_ipv6_addresses()
Line 187:     return ['/'.join([addr.address, str(addr.netmask)]) for addr in 
ipv6addrs]
Line 188: 


Line 231: 
Line 232:     return '.'.join(ip_address)
Line 233: 
Line 234: 
Line 235: def ipv6StrToAddress(ipv6_str):
I change 'QQ' to '>QQ' since it's network byte order and it works well. Of 
course a unit test should be added. Thanks
Line 236:     chr_list = [chr(int(ipv6_str[x:x + 2], 16)) for x in xrange(0, 
32, 2)]
Line 237:     return socket.inet_ntop(socket.AF_INET6, struct.pack('16c', 
*chr_list))
Line 238: 
Line 239: 


Line 252:                 ip_num = int(route_parm[2], 16)
Line 253:                 gateways[route_parm[0]] = intToAddress(ip_num)
Line 254: 
Line 255:     try:
Line 256:         with open("/proc/net/ipv6_route") as route_file:
Either getRoutes6 or getIPv6Routes would be fine in my mind.
Line 257:             for route_line in route_file.xreadlines():
Line 258:                 route_parm = route_line.rstrip().split(' ')
Line 259:                 dest = route_parm[0]
Line 260:                 prefix = route_parm[1]


Line 262:                 device = route_parm[-1]
Line 263:                 if dest == '0' * 32 and prefix == '00' and nexthop != 
'0' * 32:
Line 264:                     ipv6gateways[device] = ipv6StrToAddress(nexthop)
Line 265:     except IOError as e:
Line 266:         if e.errno == 2:
:P
Line 267:             # ipv6 module not loaded
Line 268:             pass
Line 269:         else:
Line 270:             raise e


--
To view, visit http://gerrit.ovirt.org/9381
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I2318ffa7d71abe3f57cb5e480bc46565e29f3894
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Hunt Xu <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Hunt Xu <[email protected]>
Gerrit-Reviewer: Livnat Peer <[email protected]>
Gerrit-Reviewer: Mark Wu <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to