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

addons: bond: keep link admin up after being removed from bond

with kernel 4.19, slaves that are removed from a bond will be
admin down, this patch makes sure that the links are admin up
if they are part of the "auto" class and link-down yes is not set

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
Julien Fortin
2020-09-07 12:40:40 +02:00
parent d079ad3fe8
commit 315f4f03b3

View File

@ -387,6 +387,19 @@ class bond(Addon, moduleBase):
self.netlink.link_set_protodown_off(s)
except Exception as e:
self.logger.error('%s: %s' % (ifaceobj.name, str(e)))
# ip link set $slave nomaster will set the slave admin down
# if the slave has an auto stanza, we should keep it admin up
# unless link-down yes is set
slave_class_auto = False
slave_link_down = False
for obj in ifaceobj_getfunc(s) or []:
if obj.auto:
slave_class_auto = True
if obj.link_privflags & ifaceLinkPrivFlags.KEEP_LINK_DOWN:
slave_link_down = True
if slave_class_auto and not slave_link_down:
self.netlink.link_up_force(s)
else:
# apply link-down config changes on running slaves
try: