Lei Li has posted comments on this change.
Change subject: replace ifconfig cmdline with ethtool and sysfs in netinfo
......................................................................
Patch Set 5: Fails; I would prefer that you didn't submit this
(1 inline comment)
Below is a simple reproduction of the function ethtool.get_devices() issue, for the detail
you can see my comment.
configure a second ip adrress on an interface as:
eth0 Link encap:Ethernet HWaddr 00:26:2D:F3:14:B5
inet addr:9.115.xxx.xxx Bcast:9.115.xxx.xxx Mask:255.255.255.0
inet6 addr: fe80::226:2dff:fef3:14b5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:94196 errors:0 dropped:0 overruns:0 frame:0
TX packets:72577 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:86679258 (82.6 MiB) TX bytes:8163340 (7.7 MiB)
Interrupt:20 Memory:f2600000-f2620000
eth0:1 Link encap:Ethernet HWaddr 00:26:2D:F3:14:B5
inet addr:9.115.xxx.xxx Bcast:9.115.xxx.xxx Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:f2600000-f2620000
[root@localhost network-scripts]# python
Python 2.7.2 (default, Oct 27 2011, 01:40:22)
[GCC 4.6.1 20111003 (Red Hat 4.6.1-10)] on linux2
Type "help", "copyright", "credits" or "license"
for more information.
>> import ethtool
>> interface = ethtool.get_devices()
>> interfaces = ethtool.get_active_devices()
>> interface
['lo', 'wlan0', 'eth0']
>> interfaces
['lo', 'eth0',
'eth0:1', 'wlan0']
....................................................
File vdsm/netinfo.py
Line 298: return filter(None, [ getaddr(i) for i in ethtool.get_devices() ])
As Dan said, host may have aliases.
ethtool.get_devices() can not get virtual IP addresses if they were configured on an
active network interface. So I think it would be better to use the
ethtool.get_active_devices() function instead.
--
To view, visit
http://gerrit.ovirt.org/3361
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I9e0ce521406c8f499db2ff449c5df47716a2eb23
Gerrit-PatchSet: 5
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Hunt Xu <mhuntxu(a)gmail.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Hunt Xu <mhuntxu(a)gmail.com>
Gerrit-Reviewer: Lei Li <lilei(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>