From f464e78efeebcb4489b673658d434162bb7c8484 Mon Sep 17 00:00:00 2001 From: e Date: Tue, 28 Apr 2020 13:03:37 +0800 Subject: [PATCH] =?UTF-8?q?If=20the=20"[conductor]XXX=5Ftimeout"=20is=20le?= =?UTF-8?q?ss=20than=200=EF=BC=8Cdisable=20periodic=20task?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "[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 --- ironic/conductor/manager.py | 12 +++--------- ironic/conf/conductor.py | 3 +++ .../disable_periodic_task-590a91c0a5235cfb.yaml | 8 ++++++++ 3 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 releasenotes/notes/disable_periodic_task-590a91c0a5235cfb.yaml diff --git a/ironic/conductor/manager.py b/ironic/conductor/manager.py index c662173365..a6f1b1b81e 100644 --- a/ironic/conductor/manager.py +++ b/ironic/conductor/manager.py @@ -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, diff --git a/ironic/conf/conductor.py b/ironic/conf/conductor.py index da98678a6c..5945f471c5 100644 --- a/ironic/conf/conductor.py +++ b/ironic/conf/conductor.py @@ -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 ' diff --git a/releasenotes/notes/disable_periodic_task-590a91c0a5235cfb.yaml b/releasenotes/notes/disable_periodic_task-590a91c0a5235cfb.yaml new file mode 100644 index 0000000000..a613be6651 --- /dev/null +++ b/releasenotes/notes/disable_periodic_task-590a91c0a5235cfb.yaml @@ -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. \ No newline at end of file