Antoni Segura Puimedon has uploaded a new change for review. Change subject: netinfo: replace the last dependency on ethtool with netlink ......................................................................
netinfo: replace the last dependency on ethtool with netlink After the last work on the lib/vdsm/netlink package and the extensive usage of it throughout netinfo, there was little reason to continue to have two libraries for our network information gathering. Change-Id: I32bc77d2af0fd973b31f77003652daa0912edfe4 Signed-off-by: Antoni S. Puimedon <[email protected]> --- M lib/vdsm/netinfo.py 1 file changed, 7 insertions(+), 12 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/29601/1 diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py index a412425..a204f72 100644 --- a/lib/vdsm/netinfo.py +++ b/lib/vdsm/netinfo.py @@ -33,8 +33,6 @@ import struct from xml.dom import minidom -import ethtool - from .config import config from . import constants from .ipwrapper import drv_name @@ -842,17 +840,14 @@ def getDeviceByIP(ip): """ Get network device by IP address - :param ip: String representing IPv4 or IPv6, but not link-local IPv6 + :param ip: String representing IPv4 or IPv6 """ - for info in ethtool.get_interfaces_info(ethtool.get_active_devices()): - for ipv4addr in info.get_ipv4_addresses(): - if ip in (ipv4addr.address, IPv4toMapped(ipv4addr.address)): - return info.device - - for ipv6addr in info.get_ipv6_addresses(): - if ip == ipv6addr.address: - return info.device - + for addr in nl_addr.iter_addrs(): + address = addr['address'].split('/')[0] + if ((addr['family'] == 'inet' and + ip in (address, IPv4toMapped(address))) or ( + addr['family'] == 'inet6' and ip == addr)): + return addr['label'] return '' -- To view, visit http://gerrit.ovirt.org/29601 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I32bc77d2af0fd973b31f77003652daa0912edfe4 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
