Add kombu_failover_strategy option

Adds the kombu_failover_strategy option for configuring
oslo.messaging.rabbit. This will determines how the next RabbitMQ node
is chosen in case the one we are currently connected to becomes
unavailable.

Change-Id: Icee91fe364967a443606d0287f58d06abc31f9fd
Closes-Bug: #1748353
This commit is contained in:
ZhongShengping 2018-02-09 14:43:14 +08:00
parent bc9cce1b7e
commit a2233bdb21
3 changed files with 28 additions and 11 deletions

View File

@ -61,6 +61,12 @@
# on some distributions.
# Defaults to $::os_service_default
#
# [*kombu_failover_strategy*]
# (Optional) Determines how the next RabbitMQ node is chosen in case the one
# we are currently connected to becomes unavailable. Takes effect only if
# more than one RabbitMQ node is provided in config. (string value)
# Defaults to $::os_service_default
#
# [*purge_config*]
# (optional) Whether to set only the specified config options
# in the magnum config.
@ -110,6 +116,7 @@ class magnum(
$kombu_ssl_certfile = $::os_service_default,
$kombu_ssl_keyfile = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
$kombu_failover_strategy = $::os_service_default,
$purge_config = false,
# DEPRECATED PARAMTERS
$rabbit_host = $::os_service_default,
@ -151,17 +158,18 @@ instead.")
}
oslo::messaging::rabbit { 'magnum_config':
rabbit_userid => $rabbit_userid,
rabbit_password => $rabbit_password,
rabbit_virtual_host => $rabbit_virtual_host,
rabbit_host => $rabbit_host,
rabbit_port => $rabbit_port,
rabbit_hosts => $rabbit_hosts,
rabbit_use_ssl => $rabbit_use_ssl,
kombu_ssl_version => $kombu_ssl_version,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
rabbit_userid => $rabbit_userid,
rabbit_password => $rabbit_password,
rabbit_virtual_host => $rabbit_virtual_host,
rabbit_host => $rabbit_host,
rabbit_port => $rabbit_port,
rabbit_hosts => $rabbit_hosts,
rabbit_use_ssl => $rabbit_use_ssl,
kombu_ssl_version => $kombu_ssl_version,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_failover_strategy => $kombu_failover_strategy,
}
oslo::messaging::default { 'magnum_config':

View File

@ -0,0 +1,6 @@
---
features:
- |
Adds the kombu_failover_strategy option for configuring oslo.messaging.rabbit.
This will determines how the next RabbitMQ node is chosen in case the one we
are currently connected to becomes unavailable.

View File

@ -46,6 +46,7 @@ describe 'magnum' do
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE_DEFAULT>')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_userid').with_value('<SERVICE_DEFAULT>')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('<SERVICE_DEFAULT>')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('<SERVICE_DEFAULT>')
end
it 'configures various things' do
@ -70,6 +71,7 @@ describe 'magnum' do
:rabbit_userid => 'me',
:rabbit_password => 'secrete',
:rabbit_virtual_host => 'vhost',
:kombu_failover_strategy => 'shuffle',
}
end
@ -90,6 +92,7 @@ describe 'magnum' do
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_port').with_value('1234')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_userid').with_value('me')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('vhost')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('shuffle')
end
it 'configures various things' do