From caac3e369d72eb582eb359141cfcb2a25e3791af Mon Sep 17 00:00:00 2001 From: Roopa Prabhu Date: Mon, 15 Dec 2014 17:45:49 -0800 Subject: [PATCH] fix kernel lacp_fallback_* sysfs file references to use lacp_bypass_* Ticket: Reviewed By: Testing Done: Build and sanity test --- addons/ifenslave.py | 8 ++++---- ifupdownaddons/ifenslaveutil.py | 26 +++++++++++++------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/addons/ifenslave.py b/addons/ifenslave.py index 1d08632..74c5001 100644 --- a/addons/ifenslave.py +++ b/addons/ifenslave.py @@ -172,10 +172,10 @@ class ifenslave(moduleBase): ('bond-num-unsol-na' , 'num_unsol_na'), ('bond-ad-sys-mac-addr' , 'ad_sys_mac_addr'), ('bond-ad-sys-priority' , 'ad_sys_priority'), - ('bond-lacp-fallback-allow', 'lacp_fallback_allow'), - ('bond-lacp-fallback-period', 'lacp_fallback_period'), - ('bond-lacp-bypass-allow', 'lacp_fallback_allow'), - ('bond-lacp-bypass-period', 'lacp_fallback_period')]) + ('bond-lacp-fallback-allow', 'lacp_bypass_allow'), + ('bond-lacp-fallback-period', 'lacp_bypass_period'), + ('bond-lacp-bypass-allow', 'lacp_bypass_allow'), + ('bond-lacp-bypass-period', 'lacp_bypass_period')]) linkup = self.ipcmd.is_link_up(ifaceobj.name) try: # order of attributes set matters for bond, so diff --git a/ifupdownaddons/ifenslaveutil.py b/ifupdownaddons/ifenslaveutil.py index 8a23ca5..ab21f21 100644 --- a/ifupdownaddons/ifenslaveutil.py +++ b/ifupdownaddons/ifenslaveutil.py @@ -52,7 +52,7 @@ class ifenslaveutil(utilsBase): self.read_file_oneline('/sys/class/net/%s/bonding/%s' %(bondname, x))), ['use_carrier', 'miimon', 'min_links', 'num_unsol_na', - 'num_grat_arp', 'lacp_fallback_allow', 'lacp_fallback_period']) + 'num_grat_arp', 'lacp_bypass_allow', 'lacp_bypass_period']) except Exception, e: pass @@ -231,44 +231,44 @@ class ifenslaveutil(utilsBase): return self._cache_get([bondname, 'linkinfo', 'lacp_rate']) def set_lacp_fallback_allow(self, bondname, allow, prehook=None, posthook=None): - if (self._cache_check([bondname, 'linkinfo', 'lacp_fallback_allow'], - lacp_fallback_allow)): + if (self._cache_check([bondname, 'linkinfo', 'lacp_bypass_allow'], + lacp_bypass_allow)): return if prehook: prehook(bondname) try: self.write_file('/sys/class/net/%s' %bondname + - '/bonding/lacp_fallback_allow', allow) + '/bonding/lacp_bypass_allow', allow) except: raise finally: if posthook: posthook(bondname) self._cache_update([bondname, 'linkinfo', - 'lacp_fallback_allow'], allow) + 'lacp_bypass_allow'], allow) def get_lacp_fallback_allow(self, bondname): - return self._cache_get([bondname, 'linkinfo', 'lacp_fallback_allow']) + return self._cache_get([bondname, 'linkinfo', 'lacp_bypass_allow']) def set_lacp_fallback_period(self, bondname, period, prehook=None, posthook=None): - if (self._cache_check([bondname, 'linkinfo', 'lacp_fallback_period'], - lacp_fallback_period)): + if (self._cache_check([bondname, 'linkinfo', 'lacp_bypass_period'], + lacp_bypass_period)): return if prehook: prehook(bondname) try: self.write_file('/sys/class/net/%s' %bondname + - '/bonding/lacp_fallback_period', period) + '/bonding/lacp_bypass_period', period) except: raise finally: if posthook: posthook(bondname) self._cache_update([bondname, 'linkinfo', - 'lacp_fallback_period'], period) + 'lacp_bypass_period'], period) def get_lacp_fallback_period(self, bondname): - return self._cache_get([bondname, 'linkinfo', 'lacp_fallback_period']) + return self._cache_get([bondname, 'linkinfo', 'lacp_bypass_period']) def set_min_links(self, bondname, min_links, prehook=None): if (self._cache_check([bondname, 'linkinfo', 'min_links'], @@ -284,7 +284,7 @@ class ifenslaveutil(utilsBase): return self._cache_get([bondname, 'linkinfo', 'min_links']) def set_lacp_fallback_priority(self, bondname, port, val): - slavefile = '/sys/class/net/%s/bonding_slave/lacp_fallback_priority' %port + slavefile = '/sys/class/net/%s/bonding_slave/lacp_bypass_priority' %port if os.path.exists(slavefile): self.write_file(slavefile, val) @@ -294,7 +294,7 @@ class ifenslaveutil(utilsBase): return slaves prios = [] for slave in slaves: - priofile = '/sys/class/net/%s/bonding_slave/lacp_fallback_priority' %slave + priofile = '/sys/class/net/%s/bonding_slave/lacp_bypass_priority' %slave if os.path.exists(priofile): val = self.read_file_oneline(priofile) if val and val != '0':