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: Id360da722f4bacab3835ab8b48d4de95df700736
Closes-Bug: #1748353
This commit is contained in:
ZhongShengping 2018-02-09 14:30:58 +08:00
parent 1f7a5323fe
commit 5e12d37333
3 changed files with 26 additions and 7 deletions

View File

@ -68,6 +68,12 @@
# to an AMQP consumer cancel notification. (floating point value)
# 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
#
# [*rabbit_notification_exchange*]
# Exchange name for sending notifications (string value)
# Defaults to $::os_service_default
@ -133,6 +139,7 @@ class glance::notify::rabbitmq(
$kombu_ssl_keyfile = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
$kombu_reconnect_delay = $::os_service_default,
$kombu_failover_strategy = $::os_service_default,
$rabbit_notification_exchange = $::os_service_default,
$rabbit_notification_topic = $::os_service_default,
$amqp_durable_queues = $::os_service_default,
@ -178,6 +185,7 @@ deprecated. Please use glance::notify::rabbitmq::default_transport_url instead."
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_version => $kombu_ssl_version,
kombu_reconnect_delay => $kombu_reconnect_delay,
kombu_failover_strategy => $kombu_failover_strategy,
amqp_durable_queues => $amqp_durable_queues,
kombu_compression => $kombu_compression,
}

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

@ -22,6 +22,7 @@ describe 'glance::notify::rabbitmq' do
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_registry_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_registry_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>') }
@ -42,30 +43,34 @@ describe 'glance::notify::rabbitmq' do
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('<SERVICE DEFAULT>') }
end
describe 'when passing params and use ssl' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_userid => 'guest2',
:rabbit_host => 'localhost2',
:rabbit_port => '5673',
:rabbit_use_ssl => true,
:rabbit_durable_queues => true,
:kombu_reconnect_delay => '5.0'
:rabbit_password => 'pass',
:rabbit_userid => 'guest2',
:rabbit_host => 'localhost2',
:rabbit_port => '5673',
:rabbit_use_ssl => true,
:rabbit_durable_queues => true,
:kombu_reconnect_delay => '5.0',
:kombu_failover_strategy => 'shuffle',
}
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value(true) }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('5.0') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('shuffle') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value(true) }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('5.0') }
it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('shuffle') }
it { is_expected.to contain_oslo__messaging__rabbit('glance_registry_config').with(
:rabbit_use_ssl => true,
)}