]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
bond: support for protodown reason bit settings for clag/frr
authorJulien Fortin <jfortin@nvidia.com>
Fri, 27 May 2022 12:14:39 +0000 (14:14 +0200)
committerJulien Fortin <jfortin@nvidia.com>
Fri, 27 May 2022 12:14:39 +0000 (14:14 +0200)
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
ifupdown2/addons/bond.py
ifupdown2/lib/iproute2.py

index bfd40d2aaf764ae70287f66a32338662caa9e84a..924fe09e63e0b18c6e2d48606a3e00882a9d3886 100644 (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)))
index f7f762ad647d057227a1f672f75ebf794f4e01bf..868b91f11ea2a5d2800c8ca79356037d351608ff 100644 (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
     ############################################################################