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

scheduler: do not propagate upperiface bring up error state

Ticket: CM-10016
Reviewed By:
Testing Done: Tested with the upperiface bring up case described in
CM-10016

upperiface bringup is best effort and does not imply that the current
interface bring up has an error. It only means that the upperiface may
be in an incomplete state. Hence this patch resets scheduler error state
before returning from upperiface bringup.
This commit is contained in:
Roopa Prabhu
2016-03-23 22:24:30 -07:00
parent f1c9248267
commit 892c495ea8

View File

@@ -43,6 +43,10 @@ class ifaceScheduler():
def get_sched_status(cls): def get_sched_status(cls):
return cls._SCHED_STATUS return cls._SCHED_STATUS
@classmethod
def set_sched_status(cls, state):
cls._SCHED_STATUS = state
@classmethod @classmethod
def run_iface_op(cls, ifupdownobj, ifaceobj, op, cenv=None): def run_iface_op(cls, ifupdownobj, ifaceobj, op, cenv=None):
""" Runs sub operation on an interface """ """ Runs sub operation on an interface """
@@ -91,7 +95,7 @@ class ifaceScheduler():
ifaceobj.set_state_n_status(ifaceState.from_str(op), ifaceobj.set_state_n_status(ifaceState.from_str(op),
ifaceStatus.ERROR) ifaceStatus.ERROR)
if 'up' in op or 'down' in op or 'query-checkcurr' in op: if 'up' in op or 'down' in op or 'query-checkcurr' in op:
cls._SCHED_STATUS = False cls.set_sched_status(False)
else: else:
# Mark success only if the interface was not already # Mark success only if the interface was not already
# marked with error # marked with error
@@ -527,7 +531,7 @@ class ifaceScheduler():
cls.run_iface_list(ifupdownobj, run_queue, ops, cls.run_iface_list(ifupdownobj, run_queue, ops,
parent=None, order=order, parent=None, order=order,
followdependents=followdependents) followdependents=followdependents)
if not cls._SCHED_STATUS: if not cls.get_sched_status():
return return
if (not skipupperifaces and if (not skipupperifaces and
@@ -539,6 +543,11 @@ class ifaceScheduler():
# try and execute 'up' on the upperifaces # try and execute 'up' on the upperifaces
ifupdownobj.logger.info('running upperifaces (parent interfaces) ' + ifupdownobj.logger.info('running upperifaces (parent interfaces) ' +
'if available ..') 'if available ..')
cls._STATE_CHECK = False try:
cls.run_upperifaces(ifupdownobj, ifacenames, ops) cls._STATE_CHECK = False
cls._STATE_CHECK = True cls.run_upperifaces(ifupdownobj, ifacenames, ops)
cls._STATE_CHECK = True
finally:
# upperiface bringup is best effort, so dont propagate errors
# reset scheduler status to True
cls.set_sched_status(True)