mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
CLAG id for 2.5.0
Ticket: Reviewed By: Testing Done: Yes 1. ifupdown2/bonding-driver changes to show/store clag-id (errDisabled/dormant states for bond slaves will follow in 2.5.1) 2. clagd changes for a. --forceDynamic - clagid is ignored in this mode b. (default) static mode - clagid is matched along with partner mac for dualConnection; also ad_sys_mac is only changed for clag bonds (bonds with a non-zero clag-id). Conflicts: patches/kernel/series
This commit is contained in:
@@ -99,7 +99,12 @@ class ifenslave(moduleBase):
|
||||
'required' : True,
|
||||
'example' : ['bond-slaves swp1 swp2',
|
||||
'bond-slaves glob swp1-2',
|
||||
'bond-slaves regex (swp[1|2)']}}}
|
||||
'bond-slaves regex (swp[1|2)']},
|
||||
'clag-id' :
|
||||
{'help' : 'multi-chassis lag id',
|
||||
'validrange' : ['0', '1023'],
|
||||
'default' : '0',
|
||||
'example' : ['clag-id 1']}}}
|
||||
|
||||
def __init__(self, *args, **kargs):
|
||||
ifupdownaddons.modulebase.moduleBase.__init__(self, *args, **kargs)
|
||||
@@ -176,7 +181,8 @@ class ifenslave(moduleBase):
|
||||
('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')])
|
||||
('bond-lacp-bypass-period', 'lacp_bypass_period'),
|
||||
('clag-id', 'clag_id')])
|
||||
linkup = self.ipcmd.is_link_up(ifaceobj.name)
|
||||
try:
|
||||
# order of attributes set matters for bond, so
|
||||
@@ -226,6 +232,13 @@ class ifenslave(moduleBase):
|
||||
if link_up or ifaceobj.link_type != ifaceLinkType.LINK_NA:
|
||||
rtnetlink_api.rtnl_api.link_set(slave, "up")
|
||||
|
||||
def _remove_stale_clag_id(self, ifaceobj):
|
||||
attrval = ifaceobj.get_attr_value_first('clag-id')
|
||||
if attrval is None:
|
||||
clag_id = self.ifenslavecmd.get_clag_id(ifaceobj.name)
|
||||
if clag_id != '0':
|
||||
self.ifenslavecmd.set_clag_id(ifaceobj.name, '0')
|
||||
|
||||
def _apply_slaves_lacp_bypass_prio(self, ifaceobj):
|
||||
slaves = self.ifenslavecmd.get_slaves(ifaceobj.name)
|
||||
if not slaves:
|
||||
@@ -265,6 +278,7 @@ class ifenslave(moduleBase):
|
||||
if not self.ipcmd.link_exists(ifaceobj.name):
|
||||
self.ifenslavecmd.create_bond(ifaceobj.name)
|
||||
self._apply_master_settings(ifaceobj)
|
||||
self._remove_stale_clag_id(ifaceobj)
|
||||
self._add_slaves(ifaceobj)
|
||||
self._apply_slaves_lacp_bypass_prio(ifaceobj)
|
||||
if ifaceobj.addr_method == 'manual':
|
||||
@@ -355,6 +369,8 @@ class ifenslave(moduleBase):
|
||||
self.ifenslavecmd.get_lacp_fallback_period(bondname),
|
||||
'bond-lacp-bypass-priority' :
|
||||
self.ifenslavecmd.get_lacp_fallback_priority(bondname)}
|
||||
'clag-id' :
|
||||
self.ifenslavecmd.get_clag_id(bondname)}
|
||||
slaves = self.ifenslavecmd.get_slaves(bondname)
|
||||
if slaves:
|
||||
bondattrs['bond-slaves'] = slaves
|
||||
|
@@ -52,7 +52,8 @@ 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_bypass_allow', 'lacp_bypass_period'])
|
||||
'num_grat_arp', 'lacp_bypass_allow', 'lacp_bypass_period',
|
||||
'clag_id'])
|
||||
except Exception, e:
|
||||
pass
|
||||
|
||||
@@ -190,6 +191,17 @@ class ifenslaveutil(utilsBase):
|
||||
def get_miimon(self, bondname):
|
||||
return self._cache_get([bondname, 'linkinfo', 'miimon'])
|
||||
|
||||
def set_clag_id(self, bondname, clag_id):
|
||||
if (self._cache_check([bondname, 'linkinfo', 'clag_id'],
|
||||
clag_id)):
|
||||
return
|
||||
self.write_file('/sys/class/net/%s' %bondname +
|
||||
'/bonding/clag_id', clag_id)
|
||||
self._cache_update([bondname, 'linkinfo', 'clag_id'], clag_id)
|
||||
|
||||
def get_clag_id(self, bondname):
|
||||
return self._cache_get([bondname, 'linkinfo', 'clag_id'])
|
||||
|
||||
def set_mode(self, bondname, mode, prehook=None):
|
||||
valid_modes = ['balance-rr', 'active-backup', 'balance-xor',
|
||||
'broadcast', '802.3ad', 'balance-tlb', 'balance-alb']
|
||||
|
Reference in New Issue
Block a user