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

addons: mstpctl: check mstpctl-stp and bridge-stp and fix bridge cache update

When an stp is enabled on an existing bridge mstpctl attributes are not always
configured by ifreload. This is due to a timing issue (cache) and some issue in
the mstpctl addon.

- Cache: when changing an existing bridge (done via netlink) we wait for the
kernel ack but we don't update our current cache with the new bridge attributes
This is bad because it means that the bridge cache data are stale until we
receive the notification from the kernel.

- Mstp addon: mstpctl-stp was deprecated in favor of bridge-stp, but in some
place, the mstpctl.py code checks for mstpctl-stp but not for bridge-stp. This
commit fixes the area related to this issue but this should be revisited in
a later commit

Ticket: CM-28951
Reviewed By: Roopa
Testing Done: precommit, smoke, evpn-smoke

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2020-03-18 04:17:18 +01:00
parent 8598c690e3
commit 24931ffa21
3 changed files with 11 additions and 7 deletions

View File

@@ -1466,7 +1466,7 @@ class bridge(Addon, moduleBase):
self.logger.warning('%s: bridge stp: %s' % (ifname, str(e)))
if ifla_info_data:
self.netlink.link_set_bridge_info_data(ifname, ifla_info_data, link_just_created)
self.netlink.link_set_bridge_info_data(ifname, ifla_info_data)
def _check_vids(self, ifaceobj, vids):
ret = True

View File

@@ -728,9 +728,14 @@ class mstpctl(Addon, moduleBase):
if stp:
self.set_iface_attr(ifaceobj, 'mstpctl-stp',
self.iproute2.bridge_set_stp)
stp = utils.get_boolean_from_string(stp)
else:
stp = self.cache.get_bridge_stp(ifaceobj.name)
stp = ifaceobj.get_attr_value_first('bridge-stp')
if not stp:
stp = self.cache.get_bridge_stp(ifaceobj.name)
else:
stp = utils.get_boolean_from_string(stp)
if self.mstpd_running and stp:
self.mstpctlcmd.batch_start()
self._apply_bridge_settings(ifaceobj, ifaceobj_getfunc)

View File

@@ -2774,7 +2774,7 @@ class NetlinkListenerWithCache(nllistener.NetlinkManagerWithListener, BaseObject
self.log_info_ifname_dry_run(ifname, "netlink: ip link add dev %s type bridge" % ifname)
return True
def link_set_bridge_info_data(self, ifname, ifla_info_data, link_just_created):
def link_set_bridge_info_data(self, ifname, ifla_info_data):
self.logger.info(
"%s: netlink: ip link set dev %s type bridge (with attributes)"
% (ifname, ifname)
@@ -2794,14 +2794,13 @@ class NetlinkListenerWithCache(nllistener.NetlinkManagerWithListener, BaseObject
link.build_message(self.sequence.next(), self.pid)
result = self.tx_nlpacket_get_response_with_error(link)
if link_just_created:
self.cache.update_link_info_data(ifname, ifla_info_data)
self.cache.update_link_info_data(ifname, ifla_info_data)
return result
except Exception as e:
raise Exception("%s: netlink: cannot create bridge or set attributes: %s" % (ifname, str(e)))
def link_set_bridge_info_data_dry_run(self, ifname, ifla_info_data, link_just_created):
def link_set_bridge_info_data_dry_run(self, ifname, ifla_info_data):
self.log_info_ifname_dry_run(ifname, "netlink: ip link add dev %s type bridge (with attributes)" % ifname)
self.logger.debug("attributes: %s" % ifla_info_data)