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

Merge branch 'dev' into release/cl-stable

This commit is contained in:
Roopa Prabhu
2016-05-07 20:03:23 -07:00
4 changed files with 45 additions and 35 deletions

View File

@@ -263,19 +263,20 @@ class address(moduleBase):
mtu = ifaceobj.get_attr_value_first('mtu')
if mtu:
self.ipcmd.link_set(ifaceobj.name, 'mtu', mtu)
# logical devices like bridges and vlan devices rely on mtu
# from their lower devices. ie mtu travels from
# lower devices to upper devices. For bonds mtu travels from
# upper to lower devices. running mtu depends on upper and
# lower device mtu. With all this implicit mtu
# config by the kernel in play, it becomes almost impossible
# to decide if the running mtu is valid. It will require
# some more thinking. Commenting this for now.
#elif self.default_mtu:
# running_mtu = self.ipcmd.link_get_mtu(ifaceobj.name)
# if running_mtu != self.default_mtu:
# self.ipcmd.link_set(ifaceobj.name, 'mtu', self.default_mtu)
elif (not ifaceobj.link_kind and
not (ifaceobj.link_privflags & ifaceLinkPrivFlags.BOND_SLAVE) and
self.default_mtu):
# logical devices like bridges and vlan devices rely on mtu
# from their lower devices. ie mtu travels from
# lower devices to upper devices. For bonds mtu travels from
# upper to lower devices. running mtu depends on upper and
# lower device mtu. With all this implicit mtu
# config by the kernel in play, we try to be cautious here
# on which devices we want to reset mtu to default.
# essentially only physical interfaces which are not bond slaves
running_mtu = self.ipcmd.link_get_mtu(ifaceobj.name)
if running_mtu != self.default_mtu:
self.ipcmd.link_set(ifaceobj.name, 'mtu', self.default_mtu)
alias = ifaceobj.get_attr_value_first('alias')
if alias:
@@ -334,7 +335,8 @@ class address(moduleBase):
else:
self.ipcmd.del_addr_all(ifaceobj.name)
mtu = ifaceobj.get_attr_value_first('mtu')
if (mtu and self.default_mtu and (mtu != self.default_mtu)):
if (not ifaceobj.link_kind and mtu and
self.default_mtu and (mtu != self.default_mtu)):
self.ipcmd.link_set(ifaceobj.name, 'mtu', self.default_mtu)
alias = ifaceobj.get_attr_value_first('alias')
if alias:

View File

@@ -459,10 +459,10 @@ class mstpctl(moduleBase):
pass
finally:
self.ipcmd.batch_commit()
running_ports = self.brctlcmd.get_bridge_ports(ifaceobj.name)
if running_ports:
# disable ipv6 for ports that were added to bridge
self._ports_enable_disable_ipv6(running_ports, '1')
running_ports = self.brctlcmd.get_bridge_ports(ifaceobj.name)
if running_ports:
# disable ipv6 for ports that were added to bridge
self._ports_enable_disable_ipv6(running_ports, '1')
stp = ifaceobj.get_attr_value_first('mstpctl-stp')
if stp:

View File

@@ -687,17 +687,24 @@ class vrf(moduleBase):
if vrf_table == 'auto':
vrf_table = self._get_iproute2_vrf_table(ifaceobj.name)
try:
running_slaves = self.ipcmd.link_get_lowers(ifaceobj.name)
if running_slaves:
for s in running_slaves:
if ifaceobj_getfunc:
sobj = ifaceobj_getfunc(s)
self._handle_existing_connections(sobj[0] if sobj else None,
running_slaves = self.ipcmd.link_get_lowers(ifaceobj.name)
if running_slaves:
for s in running_slaves:
if ifaceobj_getfunc:
sobj = ifaceobj_getfunc(s)
try:
self._handle_existing_connections(sobj[0]
if sobj else None,
ifaceobj.name)
except Exception, e:
self.logger.info('%s: %s' %(ifaceobj.name, str(e)))
pass
except Exception, e:
self.logger.info('%s: %s' %(ifaceobj.name, str(e)))
pass
try:
self.ipcmd.addr_flush(s)
rtnetlink_api.rtnl_api.link_set(s, "down")
except Exception, e:
self.logger.info('%s: %s' %(ifaceobj.name, str(e)))
pass
self._down_vrf_helper(ifaceobj, vrf_table)

View File

@@ -386,8 +386,9 @@ class ifupdownMain(ifupdownBase):
The following are currently considered builtin ifaces:
- vlan interfaces in the format <ifacename>.<vlanid>
"""
return (ifaceobj.priv_flags and ifaceobj.priv_flags.BUILTIN)
if (ifaceobj.priv_flags and ifaceobj.priv_flags.BUILTIN):
return True
return False
def is_ifaceobj_noconfig(self, ifaceobj):
""" Returns true if iface object did not have a user defined config.
@@ -730,9 +731,9 @@ class ifupdownMain(ifupdownBase):
if a.get('deprecated'):
newa = a.get('new-attribute')
if newa:
self.logger.warn('attribute %s is deprecated. Use %s instead' %(attrname, newa))
self.logger.warn('attribute %s is deprecated. use %s instead.' %(attrname, newa))
else:
self.logger.warn('attribute %s is deprecated'
self.logger.warn('attribute %s is deprecated.'
%attrname)
return True
except AttributeError:
@@ -1498,9 +1499,9 @@ class ifupdownMain(ifupdownBase):
# and just print a warning
if (self.is_ifaceobj_noconfig(newifaceobjlist[0]) and
not self.is_ifaceobj_builtin(newifaceobjlist[0]) and
lastifaceobjlist[0].is_config_present()):
self.logger.warn('%s: misconfig ? removed but still exists as a dependency of %s' %(newifaceobjlist[objidx].name,
str(newifaceobjlist[objidx].upperifaces)))
lastifaceobjlist[0].is_config_present() and
lastifaceobjlist[0].link_kind):
self.logger.warn('%s: misconfig ? removed but still exists as a dependency of %s' %(newifaceobjlist[objidx].name, str(newifaceobjlist[objidx].upperifaces)))
if not down_changed:
continue
if len(newifaceobjlist) != len(lastifaceobjlist):