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

addons: bond: set protodown off on bond slave before bond is deleted

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
Julien Fortin
2023-05-03 16:40:09 +02:00
parent 530e3a0b79
commit 75dea8b906

View File

@ -10,6 +10,7 @@ import re
import os
from collections import OrderedDict
from contextlib import suppress
try:
from ifupdown2.nlmanager.ipnetwork import IPv4Address
@ -928,11 +929,22 @@ class bond(Addon, moduleBase):
self.log_error(str(e), ifaceobj)
def _down(self, ifaceobj, ifaceobj_getfunc=None):
bond_slaves = self.cache.get_slaves(ifaceobj.name)
try:
self.netlink.link_del(ifaceobj.name)
except Exception as e:
self.log_warn('%s: %s' % (ifaceobj.name, str(e)))
# set protodown (and reason) off bond slaves
for slave in bond_slaves:
with suppress(Exception):
self.iproute2.link_set_protodown_reason_clag_off(slave)
with suppress(Exception):
self.iproute2.link_set_protodown_reason_frr_off(slave)
with suppress(Exception):
self.netlink.link_set_protodown_off(slave)
def _query_check_bond_slaves(self, ifaceobjcurr, attr, user_bond_slaves, running_bond_slaves):
query = 1