From: Roopa Prabhu Date: Fri, 11 Jul 2014 04:08:21 +0000 (-0700) Subject: Fix return value when upperifaces are brought up X-Git-Tag: 1.2.2-1~146^2~453^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=7ea57ea91fab498f827121c6364c0fc80a5e62ac;p=mirror_ifupdown2.git 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 --- diff --git a/pkg/scheduler.py b/pkg/scheduler.py index a98ee7e..99cc9a8 100644 --- a/pkg/scheduler.py +++ b/pkg/scheduler.py @@ -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()