Change in vdsm[master]: [3/3] Use fixed getVlanDevice() and getVlanID()

apahim at redhat.com apahim at redhat.com
Thu Aug 15 14:59:58 UTC 2013


Amador Pahim has uploaded a new change for review.

Change subject: [3/3] Use fixed getVlanDevice() and getVlanID()
......................................................................

[3/3] Use fixed getVlanDevice() and getVlanID()

Change many functions to use getVlanDevice() and getVlanID() as a
split('.') replacement.

Change-Id: I9af01e25e1257c18e6b17c4c3c5cb74dc535947a
Signed-off-by: Amador Pahim <apahim at redhat.com>
---
M lib/vdsm/netinfo.py
1 file changed, 8 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/18182/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 1c6b97d..13a9443 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -332,7 +332,7 @@
         for iface in ports(bridge):
             print '\t' + iface
             if iface in vlans():
-                iface = iface.split('.')[0]
+                iface = getVlanDevice(iface)
             if iface in bondings():
                 for slave in slaves(iface):
                     print '\t\t' + slave
@@ -347,7 +347,8 @@
     nics = []
     for iface in ports(bridge):
         if iface in vlans():
-            iface, vlan = iface.split('.')
+            iface = getVlanDevice(iface)
+            vlan = getVlanID(iface)
         if iface in bondings():
             bonding = iface
             nics = slaves(iface)
@@ -492,7 +493,7 @@
 
 def _vlaninfo(vlan):
     info = _devinfo(vlan)
-    info.update({'iface': vlan.split('.')[0], 'vlanid': getVlanID(vlan)})
+    info.update({'iface': getVlanDevice(vlan), 'vlanid': getVlanID(vlan)})
     return (vlan, info)
 
 
@@ -628,11 +629,11 @@
                 if iface == netdict['iface']:
                     yield (network, None)
                 elif netdict['iface'].startswith(iface + '.'):
-                    yield (network, netdict['iface'].split('.', 1)[1])
+                    yield (network, getVlanID(netdict['iface']))
 
     def getVlansForIface(self, iface):
         for vlanDevName in self.getVlanDevsForIface(iface):
-            yield vlanDevName.split('.', 1)[1]
+            yield getVlanID(vlanDevName)
 
     def getVlanDevsForIface(self, iface):
         for v, vdict in self.vlans.iteritems():
@@ -696,7 +697,8 @@
         for port in ports:
             if port in self.vlans:
                 assert vlan is None
-                nic, vlan = port.split('.', 1)
+                nic = getVlanDevice(port)
+                vlan = getVlanID(port)
                 assert self.vlans[port]['iface'] == nic
                 port = nic
             if port in self.bondings:


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9af01e25e1257c18e6b17c4c3c5cb74dc535947a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amador Pahim <apahim at redhat.com>


More information about the vdsm-patches mailing list