Add rabbit_ha_queues option
There are two methods for setting up RabbitMQ HA: 1. Configure rabbit_hosts to multi rabbit hosts. 2. Setting up a loadbalancer in front of RabbitMQ cluster, provide a unique address in rabbit_host In current, rabbit_ha_queues option is controled by rabbit_hosts IF conditional statement. But when users want to use the second method: changing rabbit_ha_queues to true, but they don't use rabbit_hosts option, this logic will not work. This patch adds an rabbit_ha_queues option, set it to undef by default for forward compatbility. Close-Bug: #1485287 Change-Id: Ib8fe16182188729100ef4704466c4d42d31ff510
This commit is contained in:
parent
c73c228ae7
commit
2443294da2
@ -279,12 +279,20 @@ class trove::api(
|
||||
}
|
||||
if $::trove::rabbit_hosts {
|
||||
trove_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') }
|
||||
trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
trove_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host }
|
||||
trove_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port }
|
||||
trove_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" }
|
||||
trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
|
||||
}
|
||||
|
||||
if $::trove::rabbit_ha_queues == undef {
|
||||
if size($::trove::rabbit_hosts) > 1 {
|
||||
trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
|
||||
}
|
||||
} else {
|
||||
trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $::trove::rabbit_ha_queues }
|
||||
}
|
||||
|
||||
trove_config {
|
||||
|
@ -104,12 +104,20 @@ class trove::conductor(
|
||||
}
|
||||
if $::trove::rabbit_hosts {
|
||||
trove_conductor_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') }
|
||||
trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
trove_conductor_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host }
|
||||
trove_conductor_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port }
|
||||
trove_conductor_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" }
|
||||
trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
|
||||
}
|
||||
|
||||
if $::trove::rabbit_ha_queues == undef {
|
||||
if size($::trove::rabbit_hosts) > 1 {
|
||||
trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
|
||||
}
|
||||
} else {
|
||||
trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $::trove::rabbit_ha_queues }
|
||||
}
|
||||
|
||||
trove_conductor_config {
|
||||
|
@ -101,12 +101,20 @@ class trove::guestagent(
|
||||
}
|
||||
if $::trove::rabbit_hosts {
|
||||
trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') }
|
||||
trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host }
|
||||
trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port }
|
||||
trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" }
|
||||
trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
|
||||
}
|
||||
|
||||
if $::trove::rabbit_ha_queues == undef {
|
||||
if size($::trove::rabbit_hosts) > 1 {
|
||||
trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
|
||||
}
|
||||
} else {
|
||||
trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $::trove::rabbit_ha_queues }
|
||||
}
|
||||
|
||||
trove_guestagent_config {
|
||||
|
@ -77,6 +77,10 @@
|
||||
# available on some distributions.
|
||||
# Defaults to 'TLSv1'
|
||||
#
|
||||
# [*rabbit_ha_queues*]
|
||||
# (optional) Use HA queues in RabbitMQ (x-ha-policy: all).
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*amqp_durable_queues*]
|
||||
# (optional) Define queues as "durable" to rabbitmq.
|
||||
# Defaults to false
|
||||
@ -223,12 +227,13 @@
|
||||
class trove(
|
||||
$nova_proxy_admin_pass,
|
||||
$rabbit_host = 'localhost',
|
||||
$rabbit_hosts = false,
|
||||
$rabbit_hosts = undef,
|
||||
$rabbit_password = 'guest',
|
||||
$rabbit_port = '5672',
|
||||
$rabbit_userid = 'guest',
|
||||
$rabbit_virtual_host = '/',
|
||||
$rabbit_use_ssl = false,
|
||||
$rabbit_ha_queues = undef,
|
||||
$rabbit_notification_topic = 'notifications',
|
||||
$kombu_ssl_ca_certs = undef,
|
||||
$kombu_ssl_certfile = undef,
|
||||
|
@ -162,12 +162,20 @@ class trove::taskmanager(
|
||||
}
|
||||
if $::trove::rabbit_hosts {
|
||||
trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') }
|
||||
trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host }
|
||||
trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port }
|
||||
trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" }
|
||||
trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
|
||||
}
|
||||
|
||||
if $::trove::rabbit_ha_queues == undef {
|
||||
if size($::trove::rabbit_hosts) > 1 {
|
||||
trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
|
||||
} else {
|
||||
trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
|
||||
}
|
||||
} else {
|
||||
trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $::trove::rabbit_ha_queues }
|
||||
}
|
||||
|
||||
trove_taskmanager_config {
|
||||
|
@ -118,6 +118,20 @@ describe 'trove::api' do
|
||||
end
|
||||
it 'configures trove-api with RabbitMQ' do
|
||||
is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1')
|
||||
is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when using a single RabbitMQ server with enable rabbbit_ha_queues' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
rabbit_ha_queues => 'true',
|
||||
rabbit_host => '10.0.0.1'}"
|
||||
end
|
||||
it 'configures trove-api with RabbitMQ' do
|
||||
is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1')
|
||||
is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true')
|
||||
end
|
||||
end
|
||||
|
||||
@ -129,6 +143,7 @@ describe 'trove::api' do
|
||||
end
|
||||
it 'configures trove-api with RabbitMQ' do
|
||||
is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2'])
|
||||
is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -41,6 +41,20 @@ describe 'trove::conductor' do
|
||||
end
|
||||
it 'configures trove-conductor with RabbitMQ' do
|
||||
is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1')
|
||||
is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when using a single RabbitMQ server with enable rabbbit_ha_queues' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
rabbit_ha_queues => 'true',
|
||||
rabbit_host => '10.0.0.1'}"
|
||||
end
|
||||
it 'configures trove-api with RabbitMQ' do
|
||||
is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1')
|
||||
is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true')
|
||||
end
|
||||
end
|
||||
|
||||
@ -52,6 +66,7 @@ describe 'trove::conductor' do
|
||||
end
|
||||
it 'configures trove-conductor with RabbitMQ' do
|
||||
is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2'])
|
||||
is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -43,6 +43,20 @@ describe 'trove::guestagent' do
|
||||
end
|
||||
it 'configures trove-guestagent with RabbitMQ' do
|
||||
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1')
|
||||
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when using a single RabbitMQ server with enable rabbbit_ha_queues' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
rabbit_ha_queues => 'true',
|
||||
rabbit_host => '10.0.0.1'}"
|
||||
end
|
||||
it 'configures trove-api with RabbitMQ' do
|
||||
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1')
|
||||
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true')
|
||||
end
|
||||
end
|
||||
|
||||
@ -54,6 +68,7 @@ describe 'trove::guestagent' do
|
||||
end
|
||||
it 'configures trove-guestagent with RabbitMQ' do
|
||||
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2'])
|
||||
is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -91,6 +91,20 @@ describe 'trove::taskmanager' do
|
||||
end
|
||||
it 'configures trove-taskmanager with RabbitMQ' do
|
||||
is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1')
|
||||
is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when using a single RabbitMQ server with enable rabbbit_ha_queues' do
|
||||
let :pre_condition do
|
||||
"class { 'trove':
|
||||
nova_proxy_admin_pass => 'verysecrete',
|
||||
rabbit_ha_queues => 'true',
|
||||
rabbit_host => '10.0.0.1'}"
|
||||
end
|
||||
it 'configures trove-api with RabbitMQ' do
|
||||
is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1')
|
||||
is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true')
|
||||
end
|
||||
end
|
||||
|
||||
@ -102,6 +116,7 @@ describe 'trove::taskmanager' do
|
||||
end
|
||||
it 'configures trove-taskmanager with RabbitMQ' do
|
||||
is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2'])
|
||||
is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true')
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user