summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Tantsur <divius.inside@gmail.com>2019-01-17 16:46:03 +0100
committerDmitry Tantsur <divius.inside@gmail.com>2019-01-17 16:46:03 +0100
commitab4a3bd867423b9131c8db251fecd5618930a6a5 (patch)
tree7e76194f8a6710680e7476203a35a23e256227c6
parent9a8cb3a49c6c2ac49d3472874f6ac7c9661a1672 (diff)
Prevent abnormal timeout values from breaking sync with ironic
I had a case when an operator set the timeout too a abnormally large value, which caused OverflowError in the timeout clean_up task, which, in turn, prevented ironic-inspector from ever running node list sync with ironic. This change makes two corrections: * The timeout configuration is limited to 10 years (0 can still be used to disable the timeout completely). * Errors in the clean_up task do not prevent the node list sync from running. Change-Id: Ie3ad29a4abb9ac58c41b776042f80dff6a9c72d2 Story: #2004807 Task: #28963
Notes
Notes (review): Code-Review+2: Mark Goddard <mark@stackhpc.com> Code-Review+1: Iury Gregory Melo Ferreira <iurygregory@gmail.com> Code-Review+1: Arne Wiebalck <Arne.Wiebalck@cern.ch> Code-Review+1: Riccardo Pittau <elfosardo@gmail.com> Code-Review+2: Julia Kreger <juliaashleykreger@gmail.com> Workflow+1: Julia Kreger <juliaashleykreger@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 18 Jan 2019 06:43:05 +0000 Reviewed-on: https://review.openstack.org/631538 Project: openstack/ironic-inspector Branch: refs/heads/master
-rw-r--r--ironic_inspector/conductor/manager.py6
-rw-r--r--ironic_inspector/conf/default.py3
2 files changed, 8 insertions, 1 deletions
diff --git a/ironic_inspector/conductor/manager.py b/ironic_inspector/conductor/manager.py
index c4ab958..dc6aece 100644
--- a/ironic_inspector/conductor/manager.py
+++ b/ironic_inspector/conductor/manager.py
@@ -133,10 +133,14 @@ def periodic_clean_up(): # pragma: no cover
133 try: 133 try:
134 if node_cache.clean_up(): 134 if node_cache.clean_up():
135 pxe_filter.driver().sync(ir_utils.get_client()) 135 pxe_filter.driver().sync(ir_utils.get_client())
136 sync_with_ironic()
137 except Exception: 136 except Exception:
138 LOG.exception('Periodic clean up of node cache failed') 137 LOG.exception('Periodic clean up of node cache failed')
139 138
139 try:
140 sync_with_ironic()
141 except Exception:
142 LOG.exception('Periodic sync of node list with ironic failed')
143
140 144
141def sync_with_ironic(): 145def sync_with_ironic():
142 ironic = ir_utils.get_client() 146 ironic = ir_utils.get_client()
diff --git a/ironic_inspector/conf/default.py b/ironic_inspector/conf/default.py
index 5567fb5..2c66f70 100644
--- a/ironic_inspector/conf/default.py
+++ b/ironic_inspector/conf/default.py
@@ -41,6 +41,9 @@ _OPTS = [
41 'options. "noauth" will disable all authentication.')), 41 'options. "noauth" will disable all authentication.')),
42 cfg.IntOpt('timeout', 42 cfg.IntOpt('timeout',
43 default=3600, 43 default=3600,
44 # We're using timedelta which can overflow if somebody sets this
45 # too high, so limit to a sane value of 10 years.
46 max=315576000,
44 help=_('Timeout after which introspection is considered ' 47 help=_('Timeout after which introspection is considered '
45 'failed, set to 0 to disable.')), 48 'failed, set to 0 to disable.')),
46 cfg.IntOpt('clean_up_period', 49 cfg.IntOpt('clean_up_period',