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:
@ -230,11 +230,16 @@ class ifupdownMain(ifupdownBase):
|
|||||||
self._delay_admin_state = True if self.config.get(
|
self._delay_admin_state = True if self.config.get(
|
||||||
'delay_admin_state_change', '0') == '1' else False
|
'delay_admin_state_change', '0') == '1' else False
|
||||||
self._delay_admin_state_iface_queue = []
|
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(
|
self._link_master_slave = True if self.config.get(
|
||||||
'link_master_slave', '0') == '1' else False
|
'link_master_slave', '0') == '1' else False
|
||||||
else:
|
if self._link_master_slave:
|
||||||
self._link_master_slave = False
|
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):
|
def link_master_slave_ignore_error(self, errorstr):
|
||||||
# If link master slave flag is set,
|
# If link master slave flag is set,
|
||||||
@ -833,8 +838,6 @@ class ifupdownMain(ifupdownBase):
|
|||||||
if auto:
|
if auto:
|
||||||
self.ALL = True
|
self.ALL = True
|
||||||
self.WITH_DEPENDS = True
|
self.WITH_DEPENDS = True
|
||||||
else:
|
|
||||||
self._link_master_slave = False
|
|
||||||
try:
|
try:
|
||||||
self.read_iface_config()
|
self.read_iface_config()
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -885,8 +888,6 @@ class ifupdownMain(ifupdownBase):
|
|||||||
if auto:
|
if auto:
|
||||||
self.ALL = True
|
self.ALL = True
|
||||||
self.WITH_DEPENDS = True
|
self.WITH_DEPENDS = True
|
||||||
else:
|
|
||||||
self._link_master_slave = False
|
|
||||||
# For down we need to look at old state, unless usecurrentconfig
|
# For down we need to look at old state, unless usecurrentconfig
|
||||||
# is set
|
# is set
|
||||||
if (not usecurrentconfig and self.STATEMANAGER_ENABLE and
|
if (not usecurrentconfig and self.STATEMANAGER_ENABLE and
|
||||||
@ -1016,8 +1017,6 @@ class ifupdownMain(ifupdownBase):
|
|||||||
if auto:
|
if auto:
|
||||||
self.ALL = True
|
self.ALL = True
|
||||||
self.WITH_DEPENDS = True
|
self.WITH_DEPENDS = True
|
||||||
else:
|
|
||||||
self._link_master_slave = False
|
|
||||||
try:
|
try:
|
||||||
self.read_iface_config()
|
self.read_iface_config()
|
||||||
except:
|
except:
|
||||||
@ -1091,8 +1090,6 @@ class ifupdownMain(ifupdownBase):
|
|||||||
if auto:
|
if auto:
|
||||||
self.ALL = True
|
self.ALL = True
|
||||||
self.WITH_DEPENDS = True
|
self.WITH_DEPENDS = True
|
||||||
else:
|
|
||||||
self._link_master_slave = False
|
|
||||||
try:
|
try:
|
||||||
self.read_iface_config()
|
self.read_iface_config()
|
||||||
except:
|
except:
|
||||||
|
@ -406,7 +406,7 @@ def validate_args(op, args):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def read_config():
|
def read_config(args):
|
||||||
global configmap_g
|
global configmap_g
|
||||||
|
|
||||||
config = open(configfile, 'r').read()
|
config = open(configfile, 'r').read()
|
||||||
@ -424,6 +424,18 @@ def read_config():
|
|||||||
# module can catch it appropriately
|
# module can catch it appropriately
|
||||||
configmap_g['no_repeats'] = {'bridge-vlan-aware' : 'yes'}
|
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):
|
def main(argv):
|
||||||
""" main function """
|
""" main function """
|
||||||
args = None
|
args = None
|
||||||
@ -454,7 +466,7 @@ def main(argv):
|
|||||||
print 'Another instance of this program is already running.'
|
print 'Another instance of this program is already running.'
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
read_config()
|
read_config(args)
|
||||||
init(args)
|
init(args)
|
||||||
handlers.get(op)(args)
|
handlers.get(op)(args)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
Reference in New Issue
Block a user