mirror of
https://git.proxmox.com/git/mirror_ifupdown2
synced 2025-08-16 00:23:11 +00:00
Suppress 'Network down' warnings when link_master_slave feature is on
Ticket: CM-4462 Reviewed By: Testing Done: Tested with interfaces file given in the bug. The 'network down' msg from the kernel is when the lower device is not 'admin up'. In CM-4462 it is seen when the vlan interface on the bond is 'admin up' when the bond is still in 'admin down' state. The bond is also a bridge port so, bond will be 'admin up' when the bridge it belongs to is brought up. As link_master_slave feature is on only when all network interfaces are brought up/down, the states of all interfaces will eventually converge to 'admin up', so ignoring such transient 'network down' messages.
This commit is contained in:
parent
1f87118e33
commit
61c4d72447
@ -236,6 +236,21 @@ class ifupdownMain(ifupdownBase):
|
||||
else:
|
||||
self._link_master_slave = False
|
||||
|
||||
def link_master_slave_ignore_error(self, errorstr):
|
||||
# If link master slave flag is set,
|
||||
# there may be cases where the lowerdev may not be
|
||||
# up resulting in 'Network is down' error
|
||||
# This can happen if the lowerdev is a LINK_SLAVE
|
||||
# of another interface which is not up yet
|
||||
# example of such a case:
|
||||
# bringing up a vlan on a bond interface and the bond
|
||||
# is a LINK_SLAVE of a bridge (in other words the bond is
|
||||
# part of a bridge) which is not up yet
|
||||
if self._link_master_slave:
|
||||
if 'Network is down':
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_ifaceobjs(self, ifacename):
|
||||
return self.ifaceobjdict.get(ifacename)
|
||||
|
||||
|
@ -136,8 +136,9 @@ class ifaceScheduler():
|
||||
try:
|
||||
handler(ifupdownobj, ifaceobjs[0])
|
||||
except Exception, e:
|
||||
ifupdownobj.logger.warn('%s: %s'
|
||||
%(ifaceobjs[0].name, str(e)))
|
||||
if not ifupdownobj.link_master_slave_ignore_error(str(e)):
|
||||
ifupdownobj.logger.warn('%s: %s'
|
||||
%(ifaceobjs[0].name, str(e)))
|
||||
pass
|
||||
for ifaceobj in ifaceobjs:
|
||||
cls.run_iface_op(ifupdownobj, ifaceobj, op,
|
||||
|
@ -368,7 +368,7 @@ class iproute2(utilsBase):
|
||||
def link_set_hwaddress(self, ifacename, hwaddress, force=False):
|
||||
if not force:
|
||||
if self._cache_check('link', [ifacename, 'hwaddress'], hwaddress):
|
||||
return
|
||||
return
|
||||
self.link_down(ifacename)
|
||||
cmd = 'link set dev %s address %s' %(ifacename, hwaddress)
|
||||
if self.ipbatch:
|
||||
|
Loading…
Reference in New Issue
Block a user