diff options
author | initramfs <initramfs@initramfs.io> | 2022-09-01 20:51:21 +0800 |
---|---|---|
committer | initramfs <initramfs@initramfs.io> | 2022-09-02 19:36:01 +0800 |
commit | 95e7676aa8ae5b3476b14a334b3815c2ae59f8d6 (patch) | |
tree | 941712a056349f620004eb8609fe7fd4a646937d /python/vyos/ifconfig | |
parent | 6287cc214be8f506f0656b7ad75143265213d140 (diff) | |
download | vyos-1x-95e7676aa8ae5b3476b14a334b3815c2ae59f8d6.tar.gz vyos-1x-95e7676aa8ae5b3476b14a334b3815c2ae59f8d6.zip |
bonding: T4668: fix live bonding member add or remove
Fixes several bugs around bonding member interface states not matching
the committed configuration, including:
- Disabled removed interfaces coming back up
- Newly added disabled interfaces not staying down
- Newly added interfaces not showing up in the bond
Diffstat (limited to 'python/vyos/ifconfig')
-rw-r--r-- | python/vyos/ifconfig/bond.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/python/vyos/ifconfig/bond.py b/python/vyos/ifconfig/bond.py index 98bf6162b..0edd17055 100644 --- a/python/vyos/ifconfig/bond.py +++ b/python/vyos/ifconfig/bond.py @@ -1,4 +1,4 @@ -# Copyright 2019-2021 VyOS maintainers and contributors <maintainers@vyos.io> +# Copyright 2019-2022 VyOS maintainers and contributors <maintainers@vyos.io> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -405,10 +405,12 @@ class BondIf(Interface): # Remove ALL bond member interfaces for interface in self.get_slaves(): self.del_port(interface) - # Removing an interface from a bond will always place the underlaying - # physical interface in admin-down state! If physical interface is - # not disabled, re-enable it. - if not dict_search(f'member.interface_remove.{interface}.disable', config): + + # Restore correct interface status based on config + if dict_search(f'member.interface.{interface}.disable', config) is not None or \ + dict_search(f'member.interface_remove.{interface}.disable', config) is not None: + Interface(interface).set_admin_state('down') + else: Interface(interface).set_admin_state('up') # Bonding policy/mode - default value, always present |