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:
@@ -43,6 +43,10 @@ class ifaceScheduler():
|
||||
def get_sched_status(cls):
|
||||
return cls._SCHED_STATUS
|
||||
|
||||
@classmethod
|
||||
def set_sched_status(cls, state):
|
||||
cls._SCHED_STATUS = state
|
||||
|
||||
@classmethod
|
||||
def run_iface_op(cls, ifupdownobj, ifaceobj, op, cenv=None):
|
||||
""" Runs sub operation on an interface """
|
||||
@@ -91,7 +95,7 @@ class ifaceScheduler():
|
||||
ifaceobj.set_state_n_status(ifaceState.from_str(op),
|
||||
ifaceStatus.ERROR)
|
||||
if 'up' in op or 'down' in op or 'query-checkcurr' in op:
|
||||
cls._SCHED_STATUS = False
|
||||
cls.set_sched_status(False)
|
||||
else:
|
||||
# Mark success only if the interface was not already
|
||||
# marked with error
|
||||
@@ -527,7 +531,7 @@ class ifaceScheduler():
|
||||
cls.run_iface_list(ifupdownobj, run_queue, ops,
|
||||
parent=None, order=order,
|
||||
followdependents=followdependents)
|
||||
if not cls._SCHED_STATUS:
|
||||
if not cls.get_sched_status():
|
||||
return
|
||||
|
||||
if (not skipupperifaces and
|
||||
@@ -539,6 +543,11 @@ class ifaceScheduler():
|
||||
# try and execute 'up' on the upperifaces
|
||||
ifupdownobj.logger.info('running upperifaces (parent interfaces) ' +
|
||||
'if available ..')
|
||||
cls._STATE_CHECK = False
|
||||
cls.run_upperifaces(ifupdownobj, ifacenames, ops)
|
||||
cls._STATE_CHECK = True
|
||||
try:
|
||||
cls._STATE_CHECK = False
|
||||
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)
|
||||
|
Reference in New Issue
Block a user