Browse Source

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
(cherry picked from commit ab4a3bd867)
changes/53/631753/1 8.0.2
Dmitry Tantsur 3 years ago
parent
commit
216e40f903
  1. 3
      ironic_inspector/conf/default.py
  2. 6
      ironic_inspector/wsgi_service.py

3
ironic_inspector/conf/default.py

@ -31,6 +31,9 @@ _OPTS = [
'options. "noauth" will disable all authentication.')),
cfg.IntOpt('timeout',
default=3600,
# We're using timedelta which can overflow if somebody sets this
# too high, so limit to a sane value of 10 years.
max=315576000,
help=_('Timeout after which introspection is considered '
'failed, set to 0 to disable.')),
cfg.IntOpt('node_status_keep_time',

6
ironic_inspector/wsgi_service.py

@ -216,10 +216,14 @@ def periodic_clean_up(): # pragma: no cover
try:
if node_cache.clean_up():
pxe_filter.driver().sync(ir_utils.get_client())
sync_with_ironic()
except Exception:
LOG.exception('Periodic clean up of node cache failed')
try:
sync_with_ironic()
except Exception:
LOG.exception('Periodic sync of node list with ironic failed')
def sync_with_ironic():
ironic = ir_utils.get_client()

Loading…
Cancel
Save