Allow tuning timeouts for rabbitmq pacemaker resource

This change introduces several timeout parameters so that users can
tune operation timeouts about rabbimtq resource in pacemaker.

Change-Id: Iaecdc0adb8455b2e660624f19a42e6dede5b931d
This commit is contained in:
Takashi Kajinami 2021-06-08 20:22:28 +09:00
parent 63a9008914
commit 26ee01a0d9
2 changed files with 68 additions and 2 deletions

View File

@ -63,6 +63,21 @@
# for more details.
# Defaults to hiera('step')
#
# [*start_timeout*]
# (Optional) Maximum time in second for starting up a rabbitmq server
# before pacemaker considers the operation timed out.
# Defaults to 200
#
# [*monitor_timeout*]
# (Optional) Maximum time in second for monitoring a rabbitmq server
# before pacemaker considers the operation timed out.
# Defaults to undef (use the default value in resource agent)
#
# [*stop_timeout*]
# (Optional) Maximum time in second for stopping a rabbitmq server
# before pacemaker considers the operation timed out.
# Defaults to 200
#
class tripleo::profile::pacemaker::rabbitmq (
$erlang_cookie = hiera('rabbitmq::erlang_cookie'),
$user_ha_queues = hiera('rabbitmq::nr_ha_queues', 0),
@ -74,6 +89,9 @@ class tripleo::profile::pacemaker::rabbitmq (
$notify_nodes = hiera('oslo_messaging_notify_node_names', []),
$pcs_tries = hiera('pcs_tries', 20),
$step = Integer(hiera('step')),
$start_timeout = 200,
$monitor_timeout = undef,
$stop_timeout = 200,
) {
if $rpc_scheme == 'rabbit' {
$bootstrap_node = $rpc_bootstrap_node
@ -130,12 +148,27 @@ class tripleo::profile::pacemaker::rabbitmq (
$nr_ha_queues = $user_ha_queues
$params = "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'"
}
$op_start_params = $start_timeout ? {
undef => undef,
default => "start timeout=${start_timeout}s"
}
$op_monitor_params = $monitor_timeout ? {
undef => undef,
default => "monitor timeout=${monitor_timeout}s"
}
$op_stop_params = $stop_timeout ? {
undef => undef,
default => "stop timeout=${stop_timeout}s"
}
$op_params = join(delete_undef_values([$op_start_params, $op_monitor_params, $op_stop_params]), ' ')
pacemaker::resource::ocf { 'rabbitmq':
ocf_agent_name => 'heartbeat:rabbitmq-cluster',
resource_params => $params,
clone_params => 'ordered=true interleave=true',
meta_params => 'notify=true',
op_params => 'start timeout=200s stop timeout=200s',
op_params => $op_params,
tries => $pcs_tries,
location_rule => {
resource_discovery => 'exclusive',

View File

@ -104,6 +104,22 @@
# [*force_ocf*]
# (optional) Use --force when creating the ocf resource via pcs
# Defaults to false
#
# [*start_timeout*]
# (Optional) Maximum time in second for starting up a rabbitmq server
# before pacemaker considers the operation timed out.
# Defaults to 200
#
# [*monitor_timeout*]
# (Optional) Maximum time in second for monitoring a rabbitmq server
# before pacemaker considers the operation timed out.
# Defaults to undef (use the default value in resource agent)
#
# [*stop_timeout*]
# (Optional) Maximum time in second for stopping a rabbitmq server
# before pacemaker considers the operation timed out.
# Defaults to 200
#
class tripleo::profile::pacemaker::rabbitmq_bundle (
$rabbitmq_docker_image = undef,
$rabbitmq_docker_control_port = 3122,
@ -127,6 +143,9 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
$bundle_user = 'root',
$force_ocf = false,
$start_timeout = 200,
$monitor_timeout = undef,
$stop_timeout = 200,
) {
# is this an additional nova cell?
if hiera('nova_is_additional_cell', undef) {
@ -327,11 +346,25 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
$ha_policy = merge($ha_queues_policy, $rabbitmq_extra_policies)
$ocf_params = "set_policy='ha-all ^(?!amq\\.).* ${to_json($ha_policy)}'"
$op_start_params = $start_timeout ? {
undef => undef,
default => "start timeout=${start_timeout}s"
}
$op_monitor_params = $monitor_timeout ? {
undef => undef,
default => "monitor timeout=${monitor_timeout}s"
}
$op_stop_params = $stop_timeout ? {
undef => undef,
default => "stop timeout=${stop_timeout}s"
}
$op_params = join(delete_undef_values([$op_start_params, $op_monitor_params, $op_stop_params]), ' ')
pacemaker::resource::ocf { 'rabbitmq':
ocf_agent_name => 'heartbeat:rabbitmq-cluster',
resource_params => $ocf_params,
meta_params => 'notify=true container-attribute-target=host',
op_params => 'start timeout=200s stop timeout=200s',
op_params => $op_params,
tries => $pcs_tries,
location_rule => {
resource_discovery => 'exclusive',