Add more options to configure Heartbeat options

Add parameters to configure first_heartbeat_timeout,
max_missed_heartbeats and check_interval.

Related-Bug: #1821611
Change-Id: I7a2313bed58485e077ae210d222902f4f997f0f0
This commit is contained in:
Emilien Macchi 2019-03-25 12:32:51 -04:00
parent b3a685344e
commit 104896c740
3 changed files with 56 additions and 5 deletions

View File

@ -156,6 +156,29 @@
# (Optional) Enable dbsync
# Defaults to true.
#
# [*max_missed_heartbeats*]
# (Optional) The maximum amount of missed heartbeats to be allowed.
# If set to 0 then this feature is disabled. See check_interval for more
# details.
# Defaults to $::os_service_default
#
# [*check_interval*]
# (Optional) How often (in seconds) action executions are checked.
# For example when check_interval is 10, check action
# executions every 10 seconds. When the checker runs it will
# transit all running action executions to error if the last
# heartbeat received is older than 10 * max_missed_heartbeats
# seconds. If set to 0 then this feature is disabled.
# Defaults to $::os_service_default
#
# [*first_heartbeat_timeout*]
# (Optional) The first heartbeat is handled differently, to provide a
# grace period in case there is no available executor to handle
# the action execution. For example when first_heartbeat_timeout = 3600, wait
# 3600 seconds before closing the action executions that never received a
# heartbeat.
# Defaults to $::os_service_default
#
class mistral(
$package_ensure = 'present',
$database_connection = $::os_service_default,
@ -183,6 +206,9 @@ class mistral(
$coordination_heartbeat_interval = $::os_service_default,
$purge_config = false,
$sync_db = true,
$max_missed_heartbeats = $::os_service_default,
$check_interval = $::os_service_default,
$first_heartbeat_timeout = $::os_service_default,
){
include ::mistral::deps
@ -205,6 +231,9 @@ class mistral(
'DEFAULT/report_interval': value => $report_interval;
'DEFAULT/service_down_time': value => $service_down_time;
'DEFAULT/os_actions_endpoint_type': value => $os_actions_endpoint_type;
'action_heartbeat/max_missed_heartbeats': value => $max_missed_heartbeats;
'action_heartbeat/check_interval': value => $check_interval;
'action_heartbeat/first_heartbeat_timeout': value => $first_heartbeat_timeout;
}
oslo::messaging::default {'mistral_config':

View File

@ -0,0 +1,5 @@
---
features:
- |
Add new parameters to configure hearbeat related options, max_missed_heartbeats
check_interval and first_heartbeat_timeout.

View File

@ -35,6 +35,9 @@ describe 'mistral' do
should contain_mistral_config('DEFAULT/report_interval').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('DEFAULT/service_down_time').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('DEFAULT/transport_url').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('action_heartbeat/max_missed_heartbeats').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('action_heartbeat/check_interval').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('action_heartbeat/first_heartbeat_timeout').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('oslo_messaging_notifications/transport_url').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('oslo_messaging_notifications/driver').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('oslo_messaging_notifications/topics').with(:value => '<SERVICE DEFAULT>')
@ -210,6 +213,20 @@ describe 'mistral' do
it { should contain_mistral_config('DEFAULT/os_actions_endpoint_type').with_value('internal') }
end
context 'with heartbeats parameters overridden' do
let :params do
req_params.merge({
:max_missed_heartbeats => '30',
:check_interval => '40',
:first_heartbeat_timeout => '7200',
})
end
it { should contain_mistral_config('action_heartbeat/max_missed_heartbeats').with_value('30') }
it { should contain_mistral_config('action_heartbeat/check_interval').with_value('40') }
it { should contain_mistral_config('action_heartbeat/first_heartbeat_timeout').with_value('7200') }
end
end
on_supported_os({