Add rabbit_ha_queues option
There are two ways for setting up RabbitMQ HA: 1. Configure rabbit_hosts to multi rabbit hosts. 2. Set up a loadbalancer in front of RabbitMQ cluster, provide a unique address in rabbit_host But rabbit_ha_queues option is controled by rabbit_hosts if conditional statement. When users try the second method: changing rabbit_ha_queues to true. If they don't set rabbit_hosts, then current logic will not work. This patch aims to add an rabbit_ha_queues option, set to undef by default for backward compatbility. Change-Id: Id1245002dfbb6f314c6082f554221ee247be630c
This commit is contained in:
parent
2bf8cc7f27
commit
83e6993ab3
|
@ -89,6 +89,10 @@
|
|||
# (Optional) virtualhost to use.
|
||||
# Defaults to '/'.
|
||||
#
|
||||
# [*rabbit_ha_queues*]
|
||||
# (Optional) Use HA queues in RabbitMQ (x-ha-policy: all).
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*rabbit_heartbeat_timeout_threshold*]
|
||||
# (Optional) Number of seconds after which the RabbitMQ broker is considered
|
||||
# down if the heartbeat keepalive fails. Any value >0 enables heartbeats.
|
||||
|
@ -167,6 +171,7 @@ class ceilometer(
|
|||
$rabbit_userid = 'guest',
|
||||
$rabbit_password = '',
|
||||
$rabbit_virtual_host = '/',
|
||||
$rabbit_ha_queues = undef,
|
||||
$rabbit_heartbeat_timeout_threshold = 0,
|
||||
$rabbit_heartbeat_rate = 2,
|
||||
$rabbit_use_ssl = false,
|
||||
|
@ -244,11 +249,15 @@ class ceilometer(
|
|||
}
|
||||
}
|
||||
|
||||
if $rabbit_ha_queues == undef {
|
||||
if size($rabbit_hosts) > 1 {
|
||||
ceilometer_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
ceilometer_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
|
||||
}
|
||||
} else {
|
||||
ceilometer_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues }
|
||||
}
|
||||
|
||||
ceilometer_config {
|
||||
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid;
|
||||
|
|
|
@ -45,6 +45,12 @@ describe 'ceilometer' do
|
|||
it_configures 'rabbit with SSL support'
|
||||
it_configures 'rabbit without HA support (with backward compatibility)'
|
||||
it_configures 'rabbit with connection heartbeats'
|
||||
|
||||
context 'with rabbit_ha_queues' do
|
||||
before { params.merge!( rabbit_params ).merge!( :rabbit_ha_queues => true ) }
|
||||
it_configures 'rabbit with rabbit_ha_queues'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'with rabbit_hosts parameter' do
|
||||
|
@ -159,6 +165,13 @@ describe 'ceilometer' do
|
|||
|
||||
end
|
||||
|
||||
shared_examples_for 'rabbit with rabbit_ha_queues' do
|
||||
|
||||
it 'configures rabbit' do
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value( params[:rabbit_ha_queues] )
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'rabbit with HA support' do
|
||||
|
||||
it 'configures rabbit' do
|
||||
|
|
Loading…
Reference in New Issue