]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
bondutils: caching min_links value
authorJulien Fortin <julien@cumulusnetworks.com>
Mon, 12 Dec 2016 06:34:43 +0000 (07:34 +0100)
committerJulien Fortin <julien@cumulusnetworks.com>
Mon, 12 Dec 2016 06:34:43 +0000 (07:34 +0100)
Ticket: CM-13996
Reviewed By: Roopa, Nikhil G
Testing Done:

With the following configuration:
auto bond0
iface bond0
      bond-min-links 1
      bond-mode 802.3ad
      bond-slaves eth0 eth1 eth2
      bond-xmit-hash-policy layer3+4

auto vlan0
iface vlan0
      vlan-raw-device   bond0
      address 10.132.253.4/31
      address 2a03:2260:2342:fe09::1/126

On non cumulus distribution bond-min-links doesn't default to 1
For some reasons the min_links value wasn't cache with the other
bond values, if you issue an ifreload on a running/existing configuration
since the min_links value is not cache ifreload will down the bond, set
min_links to 1, then bond up. When taking the bond down the kernel will
also flush the ipv6 address but not the ipv4 address...

The issue was reported by an ifupdown2 contributor on github. He find out
that when running ifreload the ipv6 were flushed.

Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
ifupdownaddons/bondutil.py

index 366adfa24aeef6804a352dc5db8a1a842a214922..5cc64ebf78ed31f17e525cf207155b89cec36ee1 100644 (file)
@@ -31,36 +31,64 @@ class bondutil(utilsBase):
         except:
             linkCache.links[bondname] = {'linkinfo': {}}
 
+        try:
+            linkCache.set_attr([bondname, 'linkinfo', 'min_links'],
+                               self.read_file_oneline(
+                                   '/sys/class/net/%s/bonding/min_links'
+                                   % bondname))
+        except Exception as e:
+            self.logger.debug(str(e))
         try:
             linkCache.set_attr([bondname, 'linkinfo', 'slaves'],
                 self.read_file_oneline('/sys/class/net/%s/bonding/slaves'
                 %bondname).split())
+        except Exception as e:
+            self.logger.debug(str(e))
+        try:
             linkCache.set_attr([bondname, 'linkinfo', 'mode'],
                 self.read_file_oneline('/sys/class/net/%s/bonding/mode'
                 %bondname).split()[0])
+        except Exception as e:
+            self.logger.debug(str(e))
+        try:
             linkCache.set_attr([bondname, 'linkinfo', 'xmit_hash_policy'],
                 self.read_file_oneline(
                     '/sys/class/net/%s/bonding/xmit_hash_policy'
                     %bondname).split()[0])
+        except Exception as e:
+            self.logger.debug(str(e))
+        try:
             linkCache.set_attr([bondname, 'linkinfo', 'lacp_rate'],
                 self.read_file_oneline('/sys/class/net/%s/bonding/lacp_rate'
                                        %bondname).split()[1])
+        except Exception as e:
+            self.logger.debug(str(e))
+        try:
             linkCache.set_attr([bondname, 'linkinfo', 'ad_actor_sys_prio'],
                 self.read_file_oneline('/sys/class/net/%s/bonding/ad_actor_sys_prio'
                                        %bondname))
+        except Exception as e:
+            self.logger.debug(str(e))
+        try:
             linkCache.set_attr([bondname, 'linkinfo', 'ad_actor_system'],
                 self.read_file_oneline('/sys/class/net/%s/bonding/ad_actor_system'
                                        %bondname))
+        except Exception as e:
+            self.logger.debug(str(e))
+        try:
             linkCache.set_attr([bondname, 'linkinfo', 'lacp_bypass'],
                 self.read_file_oneline('/sys/class/net/%s/bonding/lacp_bypass'
                                        %bondname).split()[1])
+        except Exception as e:
+            self.logger.debug(str(e))
+        try:
             map(lambda x: linkCache.set_attr([bondname, 'linkinfo', x],
                    self.read_file_oneline('/sys/class/net/%s/bonding/%s'
                         %(bondname, x))),
                        ['use_carrier', 'miimon', 'min_links', 'num_unsol_na',
                         'num_grat_arp'])
-        except Exception, e:
-            pass
+        except Exception as e:
+            self.logger.debug(str(e))
 
     def _bond_linkinfo_fill_all(self):
         bondstr = self.read_file_oneline('/sys/class/net/bonding_masters')