Change in vdsm[master]: netinfo: Replace getVlanDevice/ID in bootstrap with ipwrappe...

osvoboda at redhat.com osvoboda at redhat.com
Wed Nov 19 17:53:35 UTC 2014


Ondřej Svoboda has uploaded a new change for review.

Change subject: netinfo: Replace getVlanDevice/ID in bootstrap with ipwrapper.getLink
......................................................................

netinfo: Replace getVlanDevice/ID in bootstrap with ipwrapper.getLink

Change-Id: I4bfb0fa3c341a517bf444832d0531b05393ae4a9
Signed-off-by: Ondřej Svoboda <osvoboda at redhat.com>
---
M lib/vdsm/netinfo.py
M vdsm_reg/deployUtil.py.in
2 files changed, 16 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/60/35360/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 10bbecb..aaae19f 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -223,7 +223,7 @@
 
 def vlanSpeed(vlanName):
     """Returns the vlan's underlying device speed."""
-    vlanDevName = getVlanDevice(vlanName)
+    vlanDevName = _getVlanDevice(vlanName)
     vlanDev = getLink(vlanDevName)
     if vlanDev.isNIC():
         speed = nicSpeed(vlanDevName)
@@ -328,8 +328,8 @@
     nics = []
     for iface in ports(bridge):
         if iface in vlans():
-            iface = getVlanDevice(iface)
-            vlan = getVlanID(iface)
+            iface = _getVlanDevice(iface)
+            vlan = _getVlanID(iface)
         if iface in bondings():
             bonding = iface
             nics = slaves(iface)
@@ -690,13 +690,13 @@
     return any(vlan.startswith(dev + '.') for vlan in vlans())
 
 
-def getVlanDevice(vlan):
+def _getVlanDevice(vlan):
     """ Return the device of the given VLAN. """
     vlanLink = getLink(vlan)
     return vlanLink.device
 
 
-def getVlanID(vlan):
+def _getVlanID(vlan):
     """ Return the ID of the given VLAN. """
     vlanLink = getLink(vlan)
     return int(vlanLink.vlanid)
@@ -785,7 +785,7 @@
                     if iface == interface:
                         yield (network, None)
                     elif interface.startswith(iface + '.'):
-                        yield (network, getVlanID(interface))
+                        yield (network, _getVlanID(interface))
 
     def getBridgelessNetworksAndVlansForIface(self, iface):
         """ Returns tuples of (network, vlan) connected to nic/bond """
@@ -794,11 +794,11 @@
                 if iface == netdict['iface']:
                     yield (network, None)
                 elif netdict['iface'].startswith(iface + '.'):
-                    yield (network, getVlanID(netdict['iface']))
+                    yield (network, _getVlanID(netdict['iface']))
 
     def getVlansForIface(self, iface):
         for vlanDevName in self.getVlanDevsForIface(iface):
-            yield getVlanID(vlanDevName)
+            yield _getVlanID(vlanDevName)
 
     def getVlanDevsForIface(self, iface):
         for v, vdict in self.vlans.iteritems():
@@ -852,8 +852,8 @@
         for port in ports:
             if port in self.vlans:
                 assert vlan is None
-                nic = getVlanDevice(port)
-                vlan = getVlanID(port)
+                nic = _getVlanDevice(port)
+                vlan = _getVlanID(port)
                 assert self.vlans[port]['iface'] == nic
                 port = nic
             if port in self.bondings:
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index 2899411..5910bd7 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -972,21 +972,21 @@
         This helper function extract the relevant parameters of the existing
         RHEL interface, in order to create a managment bridge.
     """
-    netinfo = vdsmImport("netinfo")
+    ipwrapper = vdsmImport("ipwrapper")
 
     vlan = ''
     bonding = ''
     nic = None
 
     try:
-        vlans = netinfo.vlans()
-        if mgtIface in vlans:
-            nic = netinfo.getVlanDevice(mgtIface)
-            vlan = netinfo.getVlanID(mgtIface)
+        link = ipwrapper.getLink(mgtIface)
+        if link.isVLAN():
+            nic = link.device
+            vlan = link.vlanid
         else:
             nic = mgtIface
 
-        if nic in netinfo.bondings():
+        if ipwrapper.getLink(nic).isBOND():
             logging.error(
                 (
                     "_getRHELBridgeParams Found bonding: %s."


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4bfb0fa3c341a517bf444832d0531b05393ae4a9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda at redhat.com>


More information about the vdsm-patches mailing list