Change in vdsm[ovirt-3.6]: netinfo: do not mistake a veth device for a VLAN in ifaceUsed

edwardh at redhat.com edwardh at redhat.com
Mon Feb 22 12:25:27 UTC 2016


Edward Haas has uploaded a new change for review.

Change subject: netinfo: do not mistake a veth device for a VLAN in ifaceUsed
......................................................................

netinfo: do not mistake a veth device for a VLAN in ifaceUsed

A heuristic in the function looks for a 'device' property of a network
link to decide if a given device "backs" a VLAN and thus is "used".
Not only VLANs have the property, however. At least veth devices have it
as well. This patch improves detection by exploiting the 'type' property
to match only 'vlan's.

At least testSetupNetworksAddDelDhcp was affected by this misdetection
on Fedora 22. The presence of 'device' property may be due to netlink
library but this is just a guess. (Also, iproute2 package/ip binary
recently started showing veth1 at veth2 in its output but this need not
be related either.)

Change-Id: Iee3b45fb38f136bf69c175cbd745c89f80c299cf
Signed-off-by: Ondřej Svoboda <osvoboda at redhat.com>
Reviewed-on: https://gerrit.ovirt.org/46867
Reviewed-by: Ido Barkan <ibarkan at redhat.com>
Continuous-Integration: Jenkins CI
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
(cherry picked from commit 89c6584a4d31e31ea89266543503e9032fc1b7ea)
---
M lib/vdsm/netinfo.py
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/18/53818/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index ad35072..fcb7da0 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -1039,8 +1039,8 @@
     for linkDict in nl_link.iter_links():
         if linkDict['name'] == iface and 'master' in linkDict:  # Is it a slave
             return True
-        if linkDict.get('device') == iface:  # Does it back a vlan
-            return True
+        if linkDict.get('device') == iface and linkDict.get('type') == 'vlan':
+            return True  # it backs a VLAN
     for name, info in networks().iteritems():
         if info.get('iface') == iface:
             return True


-- 
To view, visit https://gerrit.ovirt.org/53818
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iee3b45fb38f136bf69c175cbd745c89f80c299cf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Ondřej Svoboda <osvoboda at redhat.com>


More information about the vdsm-patches mailing list