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

addons: bond: allow bond creation without slaves

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
Julien Fortin
2022-12-21 18:47:00 +01:00
parent 17485c78a4
commit 4afb9b238f

View File

@ -290,7 +290,9 @@ class bond(Addon, moduleBase):
def _is_bond(self, ifaceobj):
# at first link_kind is not set but once ifupdownmain
# calls get_dependent_ifacenames link_kind is set to BOND
return ifaceobj.link_kind & ifaceLinkKind.BOND or self.get_bond_slaves(ifaceobj)
return ifaceobj.link_kind & ifaceLinkKind.BOND \
or ifaceobj.get_attr_value_first("bond-mode") \
or self.get_bond_slaves(ifaceobj)
def get_dependent_ifacenames(self, ifaceobj, ifacenames_all=None, old_ifaceobjs=False):
""" Returns list of interfaces dependent on ifaceobj """
@ -302,7 +304,7 @@ class bond(Addon, moduleBase):
ifacenames_all)
ifaceobj.dependency_type = ifaceDependencyType.MASTER_SLAVE
# Also save a copy for future use
ifaceobj.priv_data = list(slave_list)
ifaceobj.priv_data = list(slave_list) if slave_list else []
if ifaceobj.link_type != ifaceLinkType.LINK_NA:
ifaceobj.link_type = ifaceLinkType.LINK_MASTER
ifaceobj.link_kind |= ifaceLinkKind.BOND