If the "[conductor]XXX_timeout" is less than 0,disable periodic task

"[conductor]clean_callback_timeout","[conductor]inspect_wait_timeout"
and "[conductor]inspect_wait_timeout" are a negative value will cause
an error on start up from now on.

Change-Id: Id3bef9a753be7f0c468ea3033698f0e9cd276a64
Story: 2007600
Task: 39576
This commit is contained in:
e 2020-04-28 13:03:37 +08:00 committed by yuanliu
parent 4d41af5038
commit f464e78efe
3 changed files with 14 additions and 9 deletions

View File

@ -1599,7 +1599,7 @@ class ConductorManager(base_manager.BaseConductorManager):
@periodics.periodic(
spacing=CONF.conductor.check_provision_state_interval,
enabled=CONF.conductor.check_provision_state_interval > 0
and CONF.conductor.deploy_callback_timeout != 0)
and CONF.conductor.deploy_callback_timeout > 0)
def _check_deploy_timeouts(self, context):
"""Periodically checks whether a deploy RPC call has timed out.
@ -1607,8 +1607,6 @@ class ConductorManager(base_manager.BaseConductorManager):
:param context: request context.
"""
# FIXME(rloo): If the value is < 0, it will be enabled. That doesn't
# seem right.
callback_timeout = CONF.conductor.deploy_callback_timeout
filters = {'reserved': False,
@ -1821,7 +1819,7 @@ class ConductorManager(base_manager.BaseConductorManager):
@periodics.periodic(
spacing=CONF.conductor.check_provision_state_interval,
enabled=CONF.conductor.check_provision_state_interval > 0
and CONF.conductor.clean_callback_timeout != 0)
and CONF.conductor.clean_callback_timeout > 0)
def _check_cleanwait_timeouts(self, context):
"""Periodically checks for nodes being cleaned.
@ -1830,8 +1828,6 @@ class ConductorManager(base_manager.BaseConductorManager):
:param context: request context.
"""
# FIXME(rloo): If the value is < 0, it will be enabled. That doesn't
# seem right.
callback_timeout = CONF.conductor.clean_callback_timeout
filters = {'reserved': False,
@ -2982,15 +2978,13 @@ class ConductorManager(base_manager.BaseConductorManager):
@periodics.periodic(
spacing=CONF.conductor.check_provision_state_interval,
enabled=CONF.conductor.check_provision_state_interval > 0
and CONF.conductor.inspect_wait_timeout != 0)
and CONF.conductor.inspect_wait_timeout > 0)
def _check_inspect_wait_timeouts(self, context):
"""Periodically checks inspect_wait_timeout and fails upon reaching it.
:param context: request context
"""
# FIXME(rloo): If the value is < 0, it will be enabled. That doesn't
# seem right.
callback_timeout = CONF.conductor.inspect_wait_timeout
filters = {'reserved': False,

View File

@ -70,6 +70,7 @@ opts = [
'in seconds. Set to 0 to disable checks.')),
cfg.IntOpt('deploy_callback_timeout',
default=1800,
min=0,
help=_('Timeout (seconds) to wait for a callback from '
'a deploy ramdisk. Set to 0 to disable timeout.')),
cfg.BoolOpt('force_power_state_during_sync',
@ -158,6 +159,7 @@ opts = [
'configdrive_use_object_store is True.')),
cfg.IntOpt('inspect_wait_timeout',
default=1800,
min=0,
help=_('Timeout (seconds) for waiting for node inspection. '
'0 - unlimited.')),
cfg.BoolOpt('automated_clean',
@ -192,6 +194,7 @@ opts = [
'maintenance will make the process continue.')),
cfg.IntOpt('clean_callback_timeout',
default=1800,
min=0,
help=_('Timeout (seconds) to wait for a callback from the '
'ramdisk doing the cleaning. If the timeout is reached '
'the node will be put in the "clean failed" provision '

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Fixes periodic task initialization options to prevent a negative number.
If "[conductor]clean_callback_timeout","[conductor]inspect_wait_timeout"
and "[conductor]inspect_wait_timeout" are a negative value will cause an
error on start up from now on.