Limit the timeout value of heartbeat_timeout

Set the heartbeat_timeout value too high will cause OverflowError,
which affects places where the delta value is used to check the
online status of a conductor. This involves get_offline_conductors,
_filter_active_conductors, and descending caller like the
_check_orphan_nodes periodic task, /v1/drivers endpoint, etc.

Limit the max value to 10 years as [1] does.

[1] https://review.openstack.org/#/c/631538

Story: 2004807
Task: 29021

Change-Id: I2b47fa6747e2f97c6910be708c328bed9daba455
This commit is contained in:
Kaifeng Wang 2019-01-22 13:48:13 +08:00
parent ab4778717b
commit cc73bb21fd
1 changed files with 3 additions and 0 deletions

View File

@ -41,6 +41,9 @@ opts = [
'http:// or https://.')),
cfg.IntOpt('heartbeat_timeout',
default=60,
# 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=_('Maximum time (in seconds) since the last check-in '
'of a conductor. A conductor is considered inactive '
'when this time has been exceeded.')),