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

Only warn on ifdown of an interface who has upperifaces still around +

cleanup

Ticket: CM-1438
Reviewed By:
Testing Done: Tested ifup/ifdown sanity
This commit is contained in:
roopa
2014-03-24 06:28:08 -07:00
parent 62ddec8b52
commit fa3da4be43
2 changed files with 13 additions and 15 deletions

View File

@ -726,7 +726,7 @@ class ifupdownMain(ifupdownBase):
# If iface list is given by the caller, always check if iface
# is present
if self.validate_ifaces(ifacenames) != 0:
raise Exception('all or some interfaces not found')
raise Exception('all or some interfaces were never up')
# if iface list not given by user, assume all from config file
if not ifacenames: ifacenames = self.ifaceobjdict.keys()
# filter interfaces based on auto and allow classes

View File

@ -114,7 +114,8 @@ class ifaceScheduler():
@classmethod
def _check_upperifaces(cls, ifupdownobj, ifaceobj, ops, parent, followdependents=False):
def _check_upperifaces(cls, ifupdownobj, ifaceobj, ops, parent,
followdependents=False):
""" Check if conflicting upper ifaces are around and warn if required
Returns False if this interface needs to be skipped, else return True """
@ -122,7 +123,6 @@ class ifaceScheduler():
if 'up' in ops[0] and followdependents:
return True
ifacename = ifaceobj.name
# Deal with upperdevs first
ulist = ifaceobj.upperifaces
if ulist:
@ -137,17 +137,16 @@ class ifaceScheduler():
for u in tmpulist:
if ifupdownobj.link_exists(u):
if not ifupdownobj.FORCE and not ifupdownobj.ALL:
ifupdownobj.logger.warn('%s: ' %ifacename +
' skip interface down,' +
ifupdownobj.logger.warn('%s: ' %ifaceobj.name +
'upperiface %s still around' %u)
return False
return True
elif 'up' in ops[0] and not ifupdownobj.ALL:
# For 'up', just warn that there is an upperdev which is
# probably not up
for u in tmpulist:
if not ifupdownobj.link_exists(u):
ifupdownobj.logger.warn('%s: upper iface %s '
%(ifacename, u) + 'does not exist')
ifupdownobj.logger.warn('%s: ' %ifaceobj.name +
'upper iface %s does not exist' %u)
return True
@classmethod
@ -172,8 +171,8 @@ class ifaceScheduler():
# Run lowerifaces or dependents
dlist = ifaceobj.lowerifaces
if dlist:
ifupdownobj.logger.debug('%s:' %ifacename +
' found dependents: %s' %str(dlist))
ifupdownobj.logger.debug('%s: found dependents %s'
%(ifacename, str(dlist)))
try:
if not followdependents:
# XXX: this is yet another extra step,
@ -245,8 +244,8 @@ class ifaceScheduler():
# Run upperifaces
ulist = ifaceobj.upperifaces
if ulist:
ifupdownobj.logger.debug('%s:' %ifacename +
' found upperifaces: %s' %str(ulist))
ifupdownobj.logger.debug('%s: found upperifaces %s'
%(ifacename, str(ulist)))
try:
cls.run_iface_list_upper(ifupdownobj, ulist, ops,
ifacename,
@ -442,7 +441,7 @@ class ifaceScheduler():
"""
ifupdownobj.logger.debug('%s:' %ifacename + ' %s' %op)
ifupdownobj.logger.debug('%s: %s' %(ifacename, op))
cls.accquire_token(iface)
# Each iface can have a list of objects
@ -510,7 +509,6 @@ class ifaceScheduler():
raise Exception('error starting thread for iface %s'
%ifacename)
ifupdownobj.logger.debug('%s ' %parent +
'waiting for all the threads ...')
for ifacename, t in running_threads.items():