1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

addons: bond: adding attribute bond-(up|down)delay

Ticket: CM-8424
Reviewed By: Roopa, Julien
Testing Done: using the config mentioned in bug

updelay

    Specifies the time, in milliseconds, to wait before enabling a
    slave after a link recovery has been detected.  This option is
    only valid for the miimon link monitor.

downdelay

    Specifies the time, in milliseconds, to wait before disabling
    a slave after a link failure has been detected.  This option
    is only valid for the miimon link monitor.

Signed-off-by: Nikhil Gajendrakumar <nikhil@cumulusnetworks.com>

Conflicts:
	ifupdownaddons/bondutil.py
This commit is contained in:
Nikhil
2017-01-30 14:09:58 -08:00
parent c09025b2b0
commit c3fc3b8f00
2 changed files with 36 additions and 3 deletions

View File

@@ -105,7 +105,16 @@ class bond(moduleBase):
'example' : ['bond-slaves swp1 swp2',
'bond-slaves glob swp1-2',
'bond-slaves regex (swp[1|2)'],
'aliases': ['bond-ports']}}}
'aliases': ['bond-ports']},
'bond-updelay' :
{'help' : 'bond updelay',
'default' : '0',
'example' : ['bond-updelay 100']},
'bond-downdelay':
{'help' : 'bond downdelay',
'default' : '0',
'example' : ['bond-downdelay 100']}
}}
_bond_mode_num = {'0': 'balance-rr',
'1': 'active-backup',
@@ -231,7 +240,9 @@ class bond(moduleBase):
('bond-ad-actor-system' , 'ad_actor_system'),
('bond-ad-sys-priority' , 'ad_actor_sys_prio'),
('bond-ad-actor-sys-prio' , 'ad_actor_sys_prio'),
('bond-lacp-bypass-allow', 'lacp_bypass')])
('bond-lacp-bypass-allow', 'lacp_bypass'),
('bond-updelay', 'updelay'),
('bond-downdelay', 'downdelay')])
linkup = self.ipcmd.is_link_up(ifaceobj.name)
try:
# order of attributes set matters for bond, so
@@ -408,7 +419,11 @@ class bond(moduleBase):
'bond-num-unsol-na' :
self.bondcmd.get_num_unsol_na(bondname),
'bond-num-grat-arp' :
self.bondcmd.get_num_grat_arp(bondname)}
self.bondcmd.get_num_grat_arp(bondname),
'bond-updelay' :
self.bondcmd.get_updelay(bondname),
'bond-downdelay' :
self.bondcmd.get_downdelay(bondname)}
slaves = self.bondcmd.get_slaves(bondname)
if slaves:
bondattrs['bond-slaves'] = slaves

View File

@@ -81,6 +81,18 @@ class bondutil(utilsBase):
%bondname).split()[1])
except Exception as e:
self.logger.debug(str(e))
try:
linkCache.set_attr([bondname, 'linkinfo', 'updelay'],
self.read_file_oneline('/sys/class/net/%s/bonding/updelay'
%bondname))
except Exception as e:
self.logger.debug(str(e))
try:
linkCache.set_attr([bondname, 'linkinfo', 'downdelay'],
self.read_file_oneline('/sys/class/net/%s/bonding/downdelay'
%bondname))
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'
@@ -313,6 +325,12 @@ class bondutil(utilsBase):
def get_num_grat_arp(self, bondname):
return self._cache_get([bondname, 'linkinfo', 'num_grat_arp'])
def get_updelay(self, bondname):
return self._cache_get([bondname, 'linkinfo', 'updelay'])
def get_downdelay(self, bondname):
return self._cache_get([bondname, 'linkinfo', 'downdelay'])
def enslave_slave(self, bondname, slave, prehook=None, posthook=None):
slaves = self._cache_get([bondname, 'linkinfo', 'slaves'])
if slaves and slave in slaves: return