]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
Fix return value when upperifaces are brought up
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Fri, 11 Jul 2014 04:08:21 +0000 (21:08 -0700)
committerRoopa Prabhu <roopa@cumulusnetworks.com>
Fri, 11 Jul 2014 04:08:21 +0000 (21:08 -0700)
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

pkg/scheduler.py

index a98ee7e650638bd85fc95786def029114a757ded..99cc9a83d794c140991ae601ae1f105ff5caab87 100644 (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()