Merge "RabbitMQ: always allow promotion on HA queue during failover"
This commit is contained in:
commit
1e5c120f48
|
@ -66,6 +66,10 @@
|
|||
# (Optional) Whether TLS in the internal network is enabled or not.
|
||||
# Defaults to hiera('enable_internal_tls', false)
|
||||
#
|
||||
# [*rabbitmq_extra_policies*]
|
||||
# (Optional) Hash of extra policies for the HA queues
|
||||
# Defaults to hiera('rabbitmq_extra_policies', {'ha-promote-on-shutdown' => 'always'})
|
||||
#
|
||||
# [*pcs_tries*]
|
||||
# (Optional) The number of times pcs commands should be retried.
|
||||
# Defaults to hiera('pcs_tries', 20)
|
||||
|
@ -91,6 +95,7 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
|
|||
$notify_bootstrap_node = hiera('oslo_messaging_notify_short_bootstrap_node_name'),
|
||||
$notify_nodes = hiera('oslo_messaging_notify_node_names', []),
|
||||
$enable_internal_tls = hiera('enable_internal_tls', false),
|
||||
$rabbitmq_extra_policies = hiera('rabbitmq_extra_policies', {'ha-promote-on-shutdown' => 'always'}),
|
||||
$pcs_tries = hiera('pcs_tries', 20),
|
||||
$step = Integer(hiera('step')),
|
||||
$container_backend = 'docker',
|
||||
|
@ -266,16 +271,19 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
|
|||
if $user_ha_queues == 0 {
|
||||
$nr_rabbit_nodes = size($rabbit_nodes)
|
||||
$nr_ha_queues = $nr_rabbit_nodes / 2 + ($nr_rabbit_nodes % 2)
|
||||
$params = "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'"
|
||||
$ha_queues_policy = { 'ha-mode' => 'exactly', 'ha-params' => $nr_ha_queues }
|
||||
} elsif $user_ha_queues == -1 {
|
||||
$params = 'set_policy=\'ha-all ^(?!amq\.).* {"ha-mode":"all"}\''
|
||||
$ha_queues_policy = { 'ha-mode' => 'all' }
|
||||
} else {
|
||||
$nr_ha_queues = $user_ha_queues
|
||||
$params = "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'"
|
||||
$ha_queues_policy = { 'ha-mode' => 'exactly', 'ha-params' => $nr_ha_queues }
|
||||
}
|
||||
$ha_policy = merge($ha_queues_policy, $rabbitmq_extra_policies)
|
||||
$ocf_params = "set_policy='ha-all ^(?!amq\\.).* ${to_json($ha_policy)}'"
|
||||
|
||||
pacemaker::resource::ocf { 'rabbitmq':
|
||||
ocf_agent_name => 'heartbeat:rabbitmq-cluster',
|
||||
resource_params => $params,
|
||||
resource_params => $ocf_params,
|
||||
meta_params => 'notify=true container-attribute-target=host',
|
||||
op_params => 'start timeout=200s stop timeout=200s',
|
||||
tries => $pcs_tries,
|
||||
|
@ -308,6 +316,18 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
|
|||
try_sleep => 10,
|
||||
tag => 'rabbitmq_ready',
|
||||
}
|
||||
|
||||
# Set the HA queue policy here, because the rabbitmq resource
|
||||
# agent do so very early in the bootstrap process, and it
|
||||
# doesn't seem to work reliably.
|
||||
# Note: rabbitmq_policy expects all the hash values passed
|
||||
# to 'definition' to be strings
|
||||
rabbitmq_policy { 'ha-all@/':
|
||||
applyto => 'queues',
|
||||
pattern => '^(?!amq\.).*',
|
||||
definition => hash($ha_policy.map |$k, $v| {[$k, "${v}"]}),
|
||||
}
|
||||
|
||||
# Make sure that if we create rabbitmq users at the same step it happens
|
||||
# after the cluster is up
|
||||
Exec['rabbitmq-ready'] -> Rabbitmq_user<||>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
issues:
|
||||
- |
|
||||
Allow a hiera key to add an additional rabbitmq policy in the resource
|
||||
agend.
|
Loading…
Reference in New Issue