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

bond: support for protodown reason bit settings for clag/frr

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
Julien Fortin
2022-05-27 14:14:39 +02:00
parent 0ca32fb5f7
commit 6a61093d73
2 changed files with 18 additions and 1 deletions

View File

@ -381,6 +381,10 @@ class bond(Addon, moduleBase):
if clag_bond or ifaceobj.link_privflags & ifaceLinkPrivFlags.ES_BOND:
try:
self.netlink.link_set_protodown_on(slave)
if clag_bond:
self.iproute2.link_set_protodown_reason_clag_on(slave)
else:
self.iproute2.link_set_protodown_reason_frr_on(slave)
except Exception as e:
self.logger.error('%s: %s' % (ifaceobj.name, str(e)))
@ -406,13 +410,14 @@ class bond(Addon, moduleBase):
for s in runningslaves:
# make sure that slaves are not in protodown since we are not in the clag-bond or es-bond case
if not clag_bond and not ifaceobj.link_privflags & ifaceLinkPrivFlags.ES_BOND and self.cache.get_link_protodown(s):
self.iproute2.link_set_protodown_reason_clag_off(s)
self.netlink.link_set_protodown_off(s)
if s not in slaves:
self.sysfs.bond_remove_slave(ifaceobj.name, s)
removed_slave.append(s)
if clag_bond:
try:
self.iproute2.link_set_protodown_reason_clag_off(s)
self.netlink.link_set_protodown_off(s)
except Exception as e:
self.logger.error('%s: %s' % (ifaceobj.name, str(e)))

View File

@ -427,6 +427,18 @@ class IPRoute2(Cache, Requirements):
def link_add_openvswitch(self, ifname, kind):
self.__update_cache_after_link_creation(ifname, kind)
def link_set_protodown_reason_clag_on(self, ifname):
utils.exec_command("%s link set dev %s protodown_reason clag on" % (utils.ip_cmd, ifname))
def link_set_protodown_reason_clag_off(self, ifname):
utils.exec_command("%s link set dev %s protodown_reason clag off" % (utils.ip_cmd, ifname))
def link_set_protodown_reason_frr_on(self, ifname):
utils.exec_command("%s link set dev %s protodown_reason frr on" % (utils.ip_cmd, ifname))
def link_set_protodown_reason_frr_off(self, ifname):
utils.exec_command("%s link set dev %s protodown_reason frr off" % (utils.ip_cmd, ifname))
############################################################################
# TUNNEL
############################################################################