1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

Set vlan-filtering on bridge before adding bridge ports

Ticket: CM-6806
Reviewed By: CCR-4126
Testing Done:

Currently, when doing ifup of a bridge, the bridge is created
and ports are added to bridge before vlan_filtering is set on
the bridge. This causes extra churn on switchd which has to
configure the hardware one way and then tear it down and
reconfigure it again in the new way. For mlx, it causes even
more problems.

This patch moves the vlan_filtering setting of bridge to before
member ports are being added to the bridge, and it uses the new
iproute2 command for setting the attribute instead of through
sysfs.
This commit is contained in:
Wilson Kok
2016-02-19 14:14:29 -08:00
parent 8f79f54df8
commit 5d0f83e36e
2 changed files with 12 additions and 5 deletions

View File

@@ -603,9 +603,6 @@ class bridge(moduleBase):
if self._is_running_stp_state_on(ifaceobj.name):
self.brctlcmd.set_stp(ifaceobj.name, 'no')
if ifaceobj.get_attr_value_first('bridge-vlan-aware') == 'yes':
self.write_file('/sys/class/net/%s/bridge/vlan_filtering'
%ifaceobj.name, '1')
# Use the brctlcmd bulk set method: first build a dictionary
# and then call set
bridgeattrs = { k:v for k,v in
@@ -1007,6 +1004,13 @@ class bridge(moduleBase):
self.ipcmd.link_create(ifaceobj.name, 'bridge')
except Exception, e:
raise Exception(str(e))
try:
if ifaceobj.get_attr_value_first('bridge-vlan-aware') == 'yes':
self.ipcmd.link_set(ifaceobj.name, 'vlan_filtering', '1', False, "bridge")
except Exception, e:
raise Exception(str(e))
try:
self._add_ports(ifaceobj)
except Exception, e:

View File

@@ -369,12 +369,15 @@ class iproute2(utilsBase):
def link_down(self, ifacename):
self._link_set_ifflag(ifacename, 'DOWN')
def link_set(self, ifacename, key, value=None, force=False):
def link_set(self, ifacename, key, value=None, force=False, type=None):
if not force:
if (key not in ['master', 'nomaster'] and
self._cache_check('link', [ifacename, key], value)):
return
cmd = 'link set dev %s %s' %(ifacename, key)
cmd = 'link set dev %s' %ifacename
if type:
cmd += ' type %s' %type
cmd += ' %s' %key
if value:
cmd += ' %s' %value
if self.ipbatch: