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

Fix return value when upperifaces are brought up

Ticket: CM-3208
Reviewed By:
Testing Done: Tested with testcase listed in the bug

This patch does the following:
- moves the interface error exit check to before upperifaces are brought
  up
- changes errors to warns on upperiface error (this is because
  upperiface 'up' is done as best effort to reconfigure the interface in
  question as slave device to the upper device. But if the upper device
  is not in a right state config steps can fail. And we should just
warn).
- Implicitly bringing up the upperifaces helps in most of the cases. especially
  when a bond is brought down and up. The upperiface handling code adds
  the bond back into bridges it was part of. or creates the vlan devices
  on the bond that got deleted. But there can be cases where upperifaces are
  not in the right state and this results in warnings.

  To disable the implicit upperiface handling, this patch also supports
  'skip_upperifaces=1' in /etc/network/ifupdown2/ifupdown2.conf

in future, i am thinking of an option --skip-upperifaces to ifup
This commit is contained in:
Roopa Prabhu
2014-07-10 21:08:21 -07:00
parent 3808becfbc
commit 09a304ca24

View File

@ -301,16 +301,10 @@ class ifaceScheduler():
cls.run_iface_graph_upper(ifupdownobj, ifacename, ops, parent,
followdependents, skip_root)
except Exception, e:
if continueonfailure:
if ifupdownobj.logger.isEnabledFor(logging.DEBUG):
traceback.print_tb(sys.exc_info()[2])
ifupdownobj.logger.error('%s : %s' %(ifacename, str(e)))
pass
else:
if (ifupdownobj.ignore_error(str(e))):
pass
else:
raise Exception('%s : (%s)' %(ifacename, str(e)))
if ifupdownobj.logger.isEnabledFor(logging.DEBUG):
traceback.print_tb(sys.exc_info()[2])
ifupdownobj.logger.warn('%s : %s' %(ifacename, str(e)))
pass
@classmethod
def get_sorted_iface_list(cls, ifupdownobj, ifacenames, ops,
@ -418,16 +412,18 @@ class ifaceScheduler():
cls.run_iface_list(ifupdownobj, run_queue, ops,
parent=None, order=order,
followdependents=followdependents)
if (((not ifupdownobj.ALL and followdependents) or
if not cls._SCHED_RETVAL:
raise Exception()
if (ifupdownobj.config.get('skip_upperifaces', '0') == '0' and
((not ifupdownobj.ALL and followdependents) or
followupperifaces) and
'up' in ops[0]):
# If user had given a set of interfaces to bring up
# try and execute 'up' on the upperifaces
ifupdownobj.logger.info('running upperifaces if available ..')
ifupdownobj.logger.info('running upperifaces (parent interfaces) ' +
'if available ..')
cls._STATE_CHECK = False
cls.run_iface_list_upper(ifupdownobj, ifacenames, ops,
skip_root=True)
cls._STATE_CHECK = True
if not cls._SCHED_RETVAL:
raise Exception()