1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

Move link_master_slave flag overrides to /sbin/ifupdown + log a msg to

indicate link_master_slave flag status

Ticket:
Reviewed By:
Testing Done: ifupdown2 sanity tests with link_master_slave feature on/off
This commit is contained in:
Roopa Prabhu
2014-12-29 22:07:49 -08:00
parent fff589ea4c
commit cebe79c93a
2 changed files with 23 additions and 14 deletions

View 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:
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:

View File

@ -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: