]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
Only warn on ifdown of an interface who has upperifaces still around +
authorroopa <roopa@cumulusnetworks.com>
Mon, 24 Mar 2014 13:28:08 +0000 (06:28 -0700)
committerroopa <roopa@cumulusnetworks.com>
Mon, 24 Mar 2014 13:28:08 +0000 (06:28 -0700)
cleanup

Ticket: CM-1438
Reviewed By:
Testing Done: Tested ifup/ifdown sanity

pkg/ifupdownmain.py
pkg/scheduler.py

index 13f56062d4f53dffd46c22bf1b66eab26d5508ac..eda5de8f57ae9f2f7f14d9d41c2a8e5b89caf1cd 100644 (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
index 28a3382dc17552cab546932eb26b84695af71b08..6940c9fca2f543960b9778ea5d7f32a73670eb09 100644 (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,' +
-                                    ' upperiface %s still around' %u)
-                            return False
+                            ifupdownobj.logger.warn('%s: ' %ifaceobj.name +
+                                    'upperiface %s still around' %u)
+                            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():