Change in vdsm[master]: fix getVlanID returning an int issues

asegurap at redhat.com asegurap at redhat.com
Fri Aug 23 17:43:24 UTC 2013


Antoni Segura Puimedon has uploaded a new change for review.

Change subject: fix getVlanID returning an int issues
......................................................................

fix getVlanID returning an int issues

The fact that getVlanId now returns an int causes issues across
the networking codebase due to the fact that there was a lot of
concatenation of the kind:

    vlanDev = ifacename + '.' + vlanId

which of course causes a TypeError due to trying to concatenate
string and int.

Additionally, there was code like:

if vlan:

which now that vlan is int, will be evaluated as False when we
use vlan with id 0.

Change-Id: I0221bd6ba573c564052bac468d119c2aaceef6e0
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
M vdsm/configNetwork.py
M vdsm/netmodels.py
2 files changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/18449/1

diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 155d22a..5a273d0 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -94,7 +94,7 @@
                 raise ConfigNetworkError(ne.ERR_USED_NIC, 'nic %s already '
                                          'enslaved to %s' % (nic, bond))
             topNetDev = Nic(nic, configurator, mtu=mtu, _netinfo=_netinfo)
-    if vlan:
+    if vlan is not None:
         topNetDev = Vlan(topNetDev, vlan, configurator, mtu=mtu)
     if bridge:
         topNetDev = Bridge(bridge, configurator, port=topNetDev, mtu=mtu,
@@ -211,8 +211,8 @@
 def assertBridgeClean(bridge, vlan, bonding, nics):
     ports = set(netinfo.ports(bridge))
     ifaces = set(nics)
-    if vlan:
-        ifaces.add((bonding or nics[0]) + '.' + vlan)
+    if vlan is not None:
+        ifaces.add('%s.%s' % ((bonding or nics[0]), vlan))
     else:
         ifaces.add(bonding)
 
diff --git a/vdsm/netmodels.py b/vdsm/netmodels.py
index a543e4c..1198d96 100644
--- a/vdsm/netmodels.py
+++ b/vdsm/netmodels.py
@@ -109,7 +109,7 @@
         device.master = self
         self.device = device
         self.tag = tag
-        super(Vlan, self).__init__(device.name + '.' + tag, configurator,
+        super(Vlan, self).__init__('%s.%s' % (device.name, tag), configurator,
                                    ipconfig, mtu)
 
     def __repr__(self):


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0221bd6ba573c564052bac468d119c2aaceef6e0
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