]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
ip batch support for mstp bridges + add support for multiple globs in a
authorroopa <roopa@cumulusnetworks.com>
Fri, 28 Feb 2014 06:23:03 +0000 (22:23 -0800)
committerroopa <roopa@cumulusnetworks.com>
Fri, 28 Feb 2014 06:23:03 +0000 (22:23 -0800)
single port expression + cleanup

Ticket: CM-1438
Reviewed By:
Testing Done:

This has left some dead code in. cleanup comming in subsequent patches.
ip batch support is not complete. It currently works only for mstpctl
bridges. more coming ..

init.d/networking
pkg/ifupdownmain.py
pkg/scheduler.py
pkg/statemanager.py

index 1225bd16e7a87717bde5308eda1b8c5a6d1d8976..2f2e61fd9b11c3cfbea7381bdce1c4921334ed6e 100644 (file)
@@ -30,7 +30,7 @@ verbose=
 
 perf_options() {
     # At bootup lets set perfmode
-    [ -f /var/run/network/ifstatenew ] && echo -n "" && return
+    [ -f /var/tmp/network/ifstatenew ] && echo -n "" && return
 
     echo -n "--perfmode"
 }
index 8dc26b6948187ef56074b99d31eaf6238015e7d1..ea7a94e728f988742cdaee6a00b0b21f4368616e 100644 (file)
@@ -111,6 +111,9 @@ class ifupdownMain(ifupdownBase):
         self.WITH_DEPENDS = withdepends
         self.STATEMANAGER_ENABLE = statemanager_enable
         self.CACHE = cache
+
+        # Can be used to provide hints for caching
+        self.CACHE_FLAGS = 0x0
         self._DELETE_DEPENDENT_IFACES_WITH_NOCONFIG = False
         self.ADDONS_ENABLE = addons_enable
 
@@ -478,7 +481,8 @@ class ifupdownMain(ifupdownBase):
                                         dryrun=self.DRYRUN,
                                         nowait=self.NOWAIT,
                                         perfmode=self.PERFMODE,
-                                        cache=self.CACHE)
+                                        cache=self.CACHE,
+                                        cacheflags=self.CACHE_FLAGS)
                         self.modules[mname] = minstance
                         if hasattr(minstance, 'get_modinfo'):
                             self.module_attrs[mname] = minstance.get_modinfo()
index ad09b487752502b1c8f25a0475ef9a9da8dd29af..ddb25bfaa512a6610ab593834576be08b347e38a 100644 (file)
@@ -27,7 +27,6 @@ class ifaceSchedulerFlags():
 class ifaceScheduler():
     """ scheduler functions to schedule configuration of interfaces.
 
-
     supports scheduling of interfaces serially in plain interface list
     or dependency graph format.
     """
@@ -58,16 +57,17 @@ class ifaceScheduler():
             err = 0
             try:
                 if hasattr(m, 'run'):
-                    ifupdownobj.logger.debug('%s: %s : running module %s'
-                            %(ifacename, op, mname))
+                    msg = ('%s: %s : running module %s' %(ifacename, op, mname))
                     if op == 'query-checkcurr':
                         # Dont check curr if the interface object was 
                         # auto generated
                         if (ifaceobj.priv_flags & ifupdownobj.NOCONFIG):
                             continue
+                        ifupdownobj.logger.debug(msg)
                         m.run(ifaceobj, op,
                               query_ifaceobj=ifupdownobj.create_n_save_ifaceobjcurr(ifaceobj))
                     else:
+                        ifupdownobj.logger.debug(msg)
                         m.run(ifaceobj, op)
             except Exception, e:
                 err = 1
@@ -93,6 +93,12 @@ class ifaceScheduler():
     @classmethod
     def run_iface_ops(cls, ifupdownobj, ifaceobj, ops):
         """ Runs all operations on an interface """
+        ifacename = ifaceobj.get_name()
+        # minor optimization. If operation is 'down', proceed only
+        # if interface exists in the system
+        if 'down' in ops[0] and not ifupdownobj.link_exists(ifacename):
+            ifupdownobj.logger.info('%s: does not exist' %ifacename)
+            return 
         cenv=None
         if ifupdownobj.COMPAT_EXEC_SCRIPTS:
             # For backward compatibility generate env variables
@@ -109,11 +115,6 @@ class ifaceScheduler():
                         followdependents=True):
         """ runs interface by traversing all nodes rooted at itself """
 
-        # minor optimization. If operation is 'down', proceed only
-        # if interface exists in the system
-        if 'down' in ops[0] and not ifupdownobj.link_exists(ifacename):
-            ifupdownobj.logger.info('%s: does not exist' %ifacename)
-            return 
 
         # Each ifacename can have a list of iface objects
         ifaceobjs = ifupdownobj.get_ifaceobjs(ifacename)
@@ -179,8 +180,8 @@ class ifaceScheduler():
                         pass
                     else:
                         # Dont bring the iface up if children did not come up
-                        ifaceobj.set_state_n_sttaus(ifaceState.NEW,
-                                                    ifacestatus.ERROR)
+                        ifaceobj.set_state_n_status(ifaceState.NEW,
+                                                    ifaceStatus.ERROR)
                         raise
             if order == ifaceSchedulerFlags.POSTORDER:
                 cls.run_iface_ops(ifupdownobj, ifaceobj, ops)
index 24953fe67d10f078700496b39e348de0d6a591ab..289bb20f382418345f26cdf5f5a3631a00bca17d 100644 (file)
@@ -31,7 +31,6 @@ class pickling():
         except:
             raise
 
-
     @classmethod
     def load(cls, filename):
         with open(filename, 'r') as f:
@@ -40,17 +39,18 @@ class pickling():
                 except EOFError: break
                 except: raise
 
-
-
 class stateManager():
 
-    state_file = '/run/network/ifstatenew'
-
+    state_dir = '/var/tmp/network/'
+    state_filename = 'ifstatenew'
 
     def __init__(self):
         self.ifaceobjdict = OrderedDict()
         self.logger = logging.getLogger('ifupdown.' +
                     self.__class__.__name__)
+        if not os.path.exists(self.state_dir):
+            os.mkdir(self.state_dir)
+        self.state_file = self.state_dir + self.state_filename
 
     def save_ifaceobj(self, ifaceobj):
         if self.ifaceobjdict.get(ifaceobj.get_name()) is None: