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 # If iface list is given by the caller, always check if iface
# is present # is present
if self.validate_ifaces(ifacenames) != 0: 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 iface list not given by user, assume all from config file
if not ifacenames: ifacenames = self.ifaceobjdict.keys() if not ifacenames: ifacenames = self.ifaceobjdict.keys()
# filter interfaces based on auto and allow classes # filter interfaces based on auto and allow classes

View File

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