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:
@@ -105,7 +105,16 @@ class bond(moduleBase):
|
|||||||
'example' : ['bond-slaves swp1 swp2',
|
'example' : ['bond-slaves swp1 swp2',
|
||||||
'bond-slaves glob swp1-2',
|
'bond-slaves glob swp1-2',
|
||||||
'bond-slaves regex (swp[1|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',
|
_bond_mode_num = {'0': 'balance-rr',
|
||||||
'1': 'active-backup',
|
'1': 'active-backup',
|
||||||
@@ -231,7 +240,9 @@ class bond(moduleBase):
|
|||||||
('bond-ad-actor-system' , 'ad_actor_system'),
|
('bond-ad-actor-system' , 'ad_actor_system'),
|
||||||
('bond-ad-sys-priority' , 'ad_actor_sys_prio'),
|
('bond-ad-sys-priority' , 'ad_actor_sys_prio'),
|
||||||
('bond-ad-actor-sys-prio' , '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)
|
linkup = self.ipcmd.is_link_up(ifaceobj.name)
|
||||||
try:
|
try:
|
||||||
# order of attributes set matters for bond, so
|
# order of attributes set matters for bond, so
|
||||||
@@ -408,7 +419,11 @@ class bond(moduleBase):
|
|||||||
'bond-num-unsol-na' :
|
'bond-num-unsol-na' :
|
||||||
self.bondcmd.get_num_unsol_na(bondname),
|
self.bondcmd.get_num_unsol_na(bondname),
|
||||||
'bond-num-grat-arp' :
|
'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)
|
slaves = self.bondcmd.get_slaves(bondname)
|
||||||
if slaves:
|
if slaves:
|
||||||
bondattrs['bond-slaves'] = slaves
|
bondattrs['bond-slaves'] = slaves
|
||||||
|
@@ -81,6 +81,18 @@ class bondutil(utilsBase):
|
|||||||
%bondname).split()[1])
|
%bondname).split()[1])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.debug(str(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:
|
try:
|
||||||
map(lambda x: linkCache.set_attr([bondname, 'linkinfo', x],
|
map(lambda x: linkCache.set_attr([bondname, 'linkinfo', x],
|
||||||
self.read_file_oneline('/sys/class/net/%s/bonding/%s'
|
self.read_file_oneline('/sys/class/net/%s/bonding/%s'
|
||||||
@@ -313,6 +325,12 @@ class bondutil(utilsBase):
|
|||||||
def get_num_grat_arp(self, bondname):
|
def get_num_grat_arp(self, bondname):
|
||||||
return self._cache_get([bondname, 'linkinfo', 'num_grat_arp'])
|
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):
|
def enslave_slave(self, bondname, slave, prehook=None, posthook=None):
|
||||||
slaves = self._cache_get([bondname, 'linkinfo', 'slaves'])
|
slaves = self._cache_get([bondname, 'linkinfo', 'slaves'])
|
||||||
if slaves and slave in slaves: return
|
if slaves and slave in slaves: return
|
||||||
|
Reference in New Issue
Block a user