if attrname == 'bond-mode' and attrval == '802.3ad':
dattrname = 'bond-min-links'
min_links = ifaceobj.get_attr_value_first(dattrname)
- if not min_links or min_links == '0':
- self.logger.warn('%s: required attribute %s'
+ if not min_links:
+ min_links = self.bondcmd.get_min_links(ifaceobj.name)
+ if min_links == '0':
+ self.logger.warn('%s: attribute %s'
%(ifaceobj.name, dattrname) +
- ' not present or set to \'0\'')
+ ' is set to \'0\'')
elif policy_default_val:
return policy_default_val
return attrval
[self._bond_linkinfo_fill_attrs(b) for b in bondstr.split()]
def _bond_linkinfo_fill(self, bondname, refresh=False):
- try:
- linkCache.get_attr([bondname, 'linkinfo', 'slaves'])
- return
- except:
- pass
+ if not refresh:
+ try:
+ linkCache.get_attr([bondname, 'linkinfo', 'slaves'])
+ return
+ except:
+ pass
bondstr = self.read_file_oneline('/sys/class/net/bonding_masters')
if (not bondstr or bondname not in bondstr.split()):
raise Exception('bond %s not found' %bondname)
try:
if ((attrname not in ['lacp_rate',
'lacp_bypass']) or
- ('mode', '802.3ad') in attrdict.items()):
+ self._cache_check([bondname, 'linkinfo', 'mode'], '802.3ad',
+ True)):
self.write_file('/sys/class/net/%s/bonding/%s'
%(bondname, attrname), attrval)
except Exception, e: