Change in vdsm[master]: ipwrapper: Add ovs, libteam and vlan.device reporting support
asegurap at redhat.com
asegurap at redhat.com
Fri Nov 8 19:56:50 UTC 2013
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: ipwrapper: Add ovs, libteam and vlan.device reporting support
......................................................................
ipwrapper: Add ovs, libteam and vlan.device reporting support
This patch enables proper classification of ovs bridges and
teamd "bonds" as well as adds one extra attribute to vlans and
macvlans, device, that reports upon which device they are created.
Additionally, it adds memoization to detectType so successive
calls don't need to go all the way down to cpopen for ethtool. This
is okay since it is very rare, unadvisable and probably unsupported
to change device names on the fly and use those vacant names for
other device types.
Change-Id: Ie96296fd59b1ef1a8cea3dcdee6ac6f9c33de0da
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
M lib/vdsm/ipwrapper.py
1 file changed, 9 insertions(+), 2 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/78/21078/1
diff --git a/lib/vdsm/ipwrapper.py b/lib/vdsm/ipwrapper.py
index 125efee..8cce0eb 100644
--- a/lib/vdsm/ipwrapper.py
+++ b/lib/vdsm/ipwrapper.py
@@ -26,6 +26,7 @@
from .utils import CommandPath
from .utils import execCmd
+from .utils import memoized
_IP_BINARY = CommandPath('ip', '/sbin/ip')
_ETHTOOL_BINARY = CommandPath('ethtool',
@@ -61,6 +62,8 @@
MACVLAN = 'macvlan'
DUMMY = 'dummy'
TUN = 'tun'
+ OVS = 'openvswitch'
+ TEAM = 'team'
@equals
@@ -126,10 +129,13 @@
attrs['linkType'] = (cls.detectType(attrs['name']) if detection
else None)
if attrs['linkType'] in (LinkType.VLAN, LinkType.MACVLAN):
- attrs['name'] = attrs['name'].split('@')[0]
+ name, device = attrs['name'].split('@')
+ attrs['name'] = name
+ attrs['device'] = device
return cls(**attrs)
@staticmethod
+ @memoized
def detectType(name):
"""Returns the LinkType for the specified device."""
# TODO: Add support for virtual functions
@@ -154,7 +160,8 @@
break
if driver is None:
raise ValueError('Unknown device driver type')
- if driver in (LinkType.BRIDGE, LinkType.MACVLAN, LinkType.TUN):
+ if driver in (LinkType.BRIDGE, LinkType.MACVLAN, LinkType.TUN,
+ LinkType.OVS, LinkType.TEAM):
detectedType = driver
elif driver == 'bonding':
detectedType = LinkType.BOND
--
To view, visit http://gerrit.ovirt.org/21078
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie96296fd59b1ef1a8cea3dcdee6ac6f9c33de0da
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>
More information about the vdsm-patches
mailing list