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:
Roopa Prabhu 2014-12-26 09:39:52 -08:00
parent 1f87118e33
commit 61c4d72447
3 changed files with 19 additions and 3 deletions

View File

@ -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)

View File

@ -136,6 +136,7 @@ class ifaceScheduler():
try:
handler(ifupdownobj, ifaceobjs[0])
except Exception, e:
if not ifupdownobj.link_master_slave_ignore_error(str(e)):
ifupdownobj.logger.warn('%s: %s'
%(ifaceobjs[0].name, str(e)))
pass