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
)
This commit is contained in:
parent
9b6133b1f7
commit
216e40f903
|
@ -31,6 +31,9 @@ _OPTS = [
|
||||||
'options. "noauth" will disable all authentication.')),
|
'options. "noauth" will disable all authentication.')),
|
||||||
cfg.IntOpt('timeout',
|
cfg.IntOpt('timeout',
|
||||||
default=3600,
|
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 '
|
help=_('Timeout after which introspection is considered '
|
||||||
'failed, set to 0 to disable.')),
|
'failed, set to 0 to disable.')),
|
||||||
cfg.IntOpt('node_status_keep_time',
|
cfg.IntOpt('node_status_keep_time',
|
||||||
|
|
|
@ -216,10 +216,14 @@ def periodic_clean_up(): # pragma: no cover
|
||||||
try:
|
try:
|
||||||
if node_cache.clean_up():
|
if node_cache.clean_up():
|
||||||
pxe_filter.driver().sync(ir_utils.get_client())
|
pxe_filter.driver().sync(ir_utils.get_client())
|
||||||
sync_with_ironic()
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception('Periodic clean up of node cache failed')
|
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():
|
def sync_with_ironic():
|
||||||
ironic = ir_utils.get_client()
|
ironic = ir_utils.get_client()
|
||||||
|
|
Loading…
Reference in New Issue