mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Removed lacp bypass priority mode
Ticket: CM-9494 Reviewed By: CCR-4184 Testing Done: Also removed legacy 'fallback' options. Now lacp bypass is enabled and disabled on a bond with: bond-lacp-bypass-allow [0|1]
This commit is contained in:
@@ -56,7 +56,7 @@ class bondutil(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_bypass_allow', 'lacp_bypass_period'])
|
||||
'num_grat_arp'])
|
||||
except Exception, e:
|
||||
pass
|
||||
|
||||
@@ -142,8 +142,6 @@ class bondutil(utilsBase):
|
||||
prehook(bondname)
|
||||
try:
|
||||
if ((attrname not in ['lacp_rate',
|
||||
'lacp_bypass_allow',
|
||||
'lacp_bypass_period',
|
||||
'lacp_bypass']) or
|
||||
('mode', '802.3ad') in attrdict.items()):
|
||||
self.write_file('/sys/class/net/%s/bonding/%s'
|
||||
@@ -239,45 +237,25 @@ class bondutil(utilsBase):
|
||||
def get_lacp_rate(self, bondname):
|
||||
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_bypass_allow'],
|
||||
lacp_bypass_allow)):
|
||||
def set_lacp_bypass_allow(self, bondname, allow, prehook=None, posthook=None):
|
||||
if (self._cache_check([bondname, 'linkinfo', 'lacp_bypass'],
|
||||
lacp_bypass)):
|
||||
return
|
||||
if prehook:
|
||||
prehook(bondname)
|
||||
try:
|
||||
self.write_file('/sys/class/net/%s' %bondname +
|
||||
'/bonding/lacp_bypass_allow', allow)
|
||||
'/bonding/lacp_bypass', allow)
|
||||
except:
|
||||
raise
|
||||
finally:
|
||||
if posthook:
|
||||
posthook(bondname)
|
||||
self._cache_update([bondname, 'linkinfo',
|
||||
'lacp_bypass_allow'], allow)
|
||||
'lacp_bypass'], allow)
|
||||
|
||||
def get_lacp_fallback_allow(self, bondname):
|
||||
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_bypass_period'],
|
||||
lacp_bypass_period)):
|
||||
return
|
||||
if prehook:
|
||||
prehook(bondname)
|
||||
try:
|
||||
self.write_file('/sys/class/net/%s' %bondname +
|
||||
'/bonding/lacp_bypass_period', period)
|
||||
except:
|
||||
raise
|
||||
finally:
|
||||
if posthook:
|
||||
posthook(bondname)
|
||||
self._cache_update([bondname, 'linkinfo',
|
||||
'lacp_bypass_period'], period)
|
||||
|
||||
def get_lacp_fallback_period(self, bondname):
|
||||
return self._cache_get([bondname, 'linkinfo', 'lacp_bypass_period'])
|
||||
def get_lacp_bypass_allow(self, bondname):
|
||||
return self._cache_get([bondname, 'linkinfo', 'lacp_bypass'])
|
||||
|
||||
def set_min_links(self, bondname, min_links, prehook=None):
|
||||
if (self._cache_check([bondname, 'linkinfo', 'min_links'],
|
||||
@@ -292,47 +270,6 @@ class bondutil(utilsBase):
|
||||
def get_min_links(self, bondname):
|
||||
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_bypass_priority' %port
|
||||
if os.path.exists(slavefile):
|
||||
self.write_file(slavefile, val)
|
||||
|
||||
def get_lacp_fallback_priority(self, bondname):
|
||||
slaves = self.get_slaves(bondname)
|
||||
if not slaves:
|
||||
return slaves
|
||||
prios = []
|
||||
for slave in slaves:
|
||||
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':
|
||||
prio = slave + '=' + val
|
||||
prios.append(prio)
|
||||
prios.sort()
|
||||
prio_str = ' '.join(prios)
|
||||
return prio_str
|
||||
|
||||
def set_lacp_fallback_all_active(self, bondname, useprio, prehook=None, posthook=None):
|
||||
if (self._cache_check([bondname, 'linkinfo', 'lacp_bypass'],
|
||||
lacp_bypass)):
|
||||
return
|
||||
if prehook:
|
||||
prehook(bondname)
|
||||
try:
|
||||
self.write_file('/sys/class/net/%s' %bondname +
|
||||
'/bonding/lacp_bypass', useprio)
|
||||
except:
|
||||
raise
|
||||
finally:
|
||||
if posthook:
|
||||
posthook(bondname)
|
||||
self._cache_update([bondname, 'linkinfo',
|
||||
'lacp_bypass'], useprio)
|
||||
|
||||
def get_lacp_fallback_all_active(self, bondname):
|
||||
return self._cache_get([bondname, 'linkinfo', 'lacp_bypass'])
|
||||
|
||||
def get_ad_sys_mac_addr(self, bondname):
|
||||
return self._cache_get([bondname, 'linkinfo', 'ad_sys_mac_addr'])
|
||||
|
||||
|
Reference in New Issue
Block a user