]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
Move link_master_slave flag overrides to /sbin/ifupdown + log a msg to
authorRoopa Prabhu <roopa@cumulusnetworks.com>
Tue, 30 Dec 2014 06:07:49 +0000 (22:07 -0800)
committerRoopa Prabhu <roopa@cumulusnetworks.com>
Tue, 30 Dec 2014 06:10:36 +0000 (22:10 -0800)
indicate link_master_slave flag status

Ticket:
Reviewed By:
Testing Done: ifupdown2 sanity tests with link_master_slave feature on/off

ifupdown/ifupdownmain.py
sbin/ifupdown

index 3d017043758b4e2063d164819b69b71b104b6b89..4c3a52721a5f5105ef1c28ee43dc5ed94a182da6 100644 (file)
@@ -230,11 +230,16 @@ class ifupdownMain(ifupdownBase):
         self._delay_admin_state = True if self.config.get(
                             'delay_admin_state_change', '0') == '1' else False
         self._delay_admin_state_iface_queue = []
-        if not self._delay_admin_state:
-            self._link_master_slave = True if self.config.get(
+        if self._delay_admin_state:
+            self.logger.info('\'delay_admin_state_change\' is set. admin ' +
+                             'state changes will be delayed till the end.')
+
+        self._link_master_slave = True if self.config.get(
                       'link_master_slave', '0') == '1' else False
-        else:
-            self._link_master_slave = False
+        if self._link_master_slave:
+            self.logger.info('\'link_master_slave\' is set. slave admin ' +
+                             'state changes will be delayed till the ' +
+                             'masters admin state change.')
 
     def link_master_slave_ignore_error(self, errorstr):
         # If link master slave flag is set, 
@@ -833,8 +838,6 @@ class ifupdownMain(ifupdownBase):
         if auto:
             self.ALL = True
             self.WITH_DEPENDS = True
-        else:
-            self._link_master_slave = False
         try:
             self.read_iface_config()
         except Exception:
@@ -885,8 +888,6 @@ class ifupdownMain(ifupdownBase):
         if auto:
             self.ALL = True
             self.WITH_DEPENDS = True
-        else:
-            self._link_master_slave = False
         # For down we need to look at old state, unless usecurrentconfig
         # is set
         if (not usecurrentconfig and self.STATEMANAGER_ENABLE and
@@ -1016,8 +1017,6 @@ class ifupdownMain(ifupdownBase):
         if auto:
             self.ALL = True
             self.WITH_DEPENDS = True
-        else:
-            self._link_master_slave = False
         try:
             self.read_iface_config()
         except:
@@ -1091,8 +1090,6 @@ class ifupdownMain(ifupdownBase):
         if auto:
             self.ALL = True
             self.WITH_DEPENDS = True
-        else:
-            self._link_master_slave = False
         try:
             self.read_iface_config()
         except:
index 13874ac232ac3f2c48d65b307a052903edf9acaa..7041f343c1421fdf0cec2f786ae67de8bea719c7 100755 (executable)
@@ -406,7 +406,7 @@ def validate_args(op, args):
         return False
     return True
 
-def read_config():
+def read_config(args):
     global configmap_g
 
     config = open(configfile, 'r').read()
@@ -424,6 +424,18 @@ def read_config():
         # module can catch it appropriately
         configmap_g['no_repeats'] = {'bridge-vlan-aware' : 'yes'}
 
+
+    configval = configmap_g.get('link_master_slave', '0')
+    if configval == '1':
+        # link_master_slave is only valid when all is set
+        if hasattr(args, 'all') and not args.all:
+            configmap_g['link_master_slave'] = '0'
+
+    configval = configmap_g.get('delay_admin_state_change', '0')
+    if configval == '1':
+        # reset link_master_slave if delay_admin_state_change is on
+        configmap_g['link_master_slave'] = '0'
+
 def main(argv):
     """ main function """
     args = None
@@ -454,7 +466,7 @@ def main(argv):
             print 'Another instance of this program is already running.'
             exit(0)
 
-        read_config()
+        read_config(args)
         init(args)
         handlers.get(op)(args)
     except Exception, e: