From 5e12d373339c76b9c0c0e24d854770693a999b1d Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Fri, 9 Feb 2018 14:30:58 +0800 Subject: [PATCH] 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 --- manifests/notify/rabbitmq.pp | 8 ++++++++ ...rabbit_kombu_options-b5c925f0f593b95e.yaml | 6 ++++++ spec/classes/glance_notify_rabbitmq_spec.rb | 19 ++++++++++++------- 3 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/add_rabbit_kombu_options-b5c925f0f593b95e.yaml diff --git a/manifests/notify/rabbitmq.pp b/manifests/notify/rabbitmq.pp index 9c60bdb0..28dc710c 100644 --- a/manifests/notify/rabbitmq.pp +++ b/manifests/notify/rabbitmq.pp @@ -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, } diff --git a/releasenotes/notes/add_rabbit_kombu_options-b5c925f0f593b95e.yaml b/releasenotes/notes/add_rabbit_kombu_options-b5c925f0f593b95e.yaml new file mode 100644 index 00000000..8ade1157 --- /dev/null +++ b/releasenotes/notes/add_rabbit_kombu_options-b5c925f0f593b95e.yaml @@ -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. diff --git a/spec/classes/glance_notify_rabbitmq_spec.rb b/spec/classes/glance_notify_rabbitmq_spec.rb index 5a38359a..7260d053 100644 --- a/spec/classes/glance_notify_rabbitmq_spec.rb +++ b/spec/classes/glance_notify_rabbitmq_spec.rb @@ -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('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') } + it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('') } it { is_expected.to contain_glance_registry_config('DEFAULT/transport_url').with_value('') } it { is_expected.to contain_glance_registry_config('DEFAULT/rpc_response_timeout').with_value('') } @@ -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('') } it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/heartbeat_rate').with_value('') } it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') } + it { is_expected.to contain_glance_registry_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('') } 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, )}