From 15265bd46f6db2816bc99ec29275e7345644484e Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Fri, 9 Feb 2018 14:21:53 +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: Ia08af6da0976697d65bcc1b55b857b0f4a5742bc Closes-Bug: #1748353 --- manifests/init.pp | 36 ++++++---- ...rabbit_kombu_options-8d187aa78e4dfd62.yaml | 6 ++ spec/classes/designate_init_spec.rb | 66 ++++++++++--------- 3 files changed, 63 insertions(+), 45 deletions(-) create mode 100644 releasenotes/notes/add_rabbit_kombu_options-8d187aa78e4dfd62.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 42a70e96..c9715de6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -95,6 +95,12 @@ # consumer cancel notification. # 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 +# # [*notification_driver*] # (optional) Driver used for issuing notifications # Defaults to 'messaging' @@ -165,6 +171,7 @@ class designate( $kombu_ssl_keyfile = $::os_service_default, $kombu_ssl_version = $::os_service_default, $kombu_reconnect_delay = $::os_service_default, + $kombu_failover_strategy = $::os_service_default, $notification_driver = 'messaging', $default_transport_url = $::os_service_default, $rpc_response_timeout = $::os_service_default, @@ -250,20 +257,21 @@ to your desired configuration.") } oslo::messaging::rabbit { 'designate_config': - 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_reconnect_delay => $kombu_reconnect_delay, - rabbit_host => $rabbit_host, - rabbit_port => $rabbit_port, - rabbit_hosts => $rabbit_hosts, - rabbit_use_ssl => $rabbit_use_ssl, - rabbit_userid => $rabbit_userid, - rabbit_password => $rabbit_password, - rabbit_virtual_host => $rabbit_virtual_host, - rabbit_ha_queues => $rabbit_ha_queues_real, - amqp_durable_queues => $amqp_durable_queues, + 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_reconnect_delay => $kombu_reconnect_delay, + kombu_failover_strategy => $kombu_failover_strategy, + rabbit_host => $rabbit_host, + rabbit_port => $rabbit_port, + rabbit_hosts => $rabbit_hosts, + rabbit_use_ssl => $rabbit_use_ssl, + rabbit_userid => $rabbit_userid, + rabbit_password => $rabbit_password, + rabbit_virtual_host => $rabbit_virtual_host, + rabbit_ha_queues => $rabbit_ha_queues_real, + amqp_durable_queues => $amqp_durable_queues, } oslo::messaging::default { 'designate_config': diff --git a/releasenotes/notes/add_rabbit_kombu_options-8d187aa78e4dfd62.yaml b/releasenotes/notes/add_rabbit_kombu_options-8d187aa78e4dfd62.yaml new file mode 100644 index 00000000..8ade1157 --- /dev/null +++ b/releasenotes/notes/add_rabbit_kombu_options-8d187aa78e4dfd62.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/designate_init_spec.rb b/spec/classes/designate_init_spec.rb index a7527f53..2942d962 100644 --- a/spec/classes/designate_init_spec.rb +++ b/spec/classes/designate_init_spec.rb @@ -42,47 +42,50 @@ describe 'designate' do let :rabbit_use_ssl do { - :rabbit_host => '127.0.0.1', - :rabbit_port => 5672, - :rabbit_userid => 'guest', - :rabbit_password => '', - :rabbit_virtual_host => '/', - :rabbit_use_ssl => true, - :kombu_ssl_ca_certs => 'ca goes here', - :kombu_ssl_certfile => 'cert goes here', - :kombu_ssl_keyfile => 'key goes here', - :kombu_ssl_version => 'TLSv1', - :kombu_reconnect_delay => '1.0', + :rabbit_host => '127.0.0.1', + :rabbit_port => 5672, + :rabbit_userid => 'guest', + :rabbit_password => '', + :rabbit_virtual_host => '/', + :rabbit_use_ssl => true, + :kombu_ssl_ca_certs => 'ca goes here', + :kombu_ssl_certfile => 'cert goes here', + :kombu_ssl_keyfile => 'key goes here', + :kombu_ssl_version => 'TLSv1', + :kombu_reconnect_delay => '1.0', + :kombu_failover_strategy => 'shuffle', } end let :rabbit_use_ssl_cert_no_key do { - :rabbit_host => '127.0.0.1', - :rabbit_port => 5672, - :rabbit_userid => 'guest', - :rabbit_password => '', - :rabbit_virtual_host => '/', - :rabbit_use_ssl => true, - :kombu_ssl_ca_certs => 'ca goes here', - :kombu_ssl_certfile => 'cert goes here', - :kombu_ssl_version => 'TLSv1', - :kombu_reconnect_delay => '1.0', + :rabbit_host => '127.0.0.1', + :rabbit_port => 5672, + :rabbit_userid => 'guest', + :rabbit_password => '', + :rabbit_virtual_host => '/', + :rabbit_use_ssl => true, + :kombu_ssl_ca_certs => 'ca goes here', + :kombu_ssl_certfile => 'cert goes here', + :kombu_ssl_version => 'TLSv1', + :kombu_reconnect_delay => '1.0', + :kombu_failover_strategy => 'shuffle', } end let :rabbit_use_ssl_key_no_cert do { - :rabbit_host => '127.0.0.1', - :rabbit_port => 5672, - :rabbit_userid => 'guest', - :rabbit_password => '', - :rabbit_virtual_host => '/', - :rabbit_use_ssl => true, - :kombu_ssl_ca_certs => 'ca goes here', - :kombu_ssl_keyfile => 'key goes here', - :kombu_ssl_version => 'TLSv1', - :kombu_reconnect_delay => '1.0', + :rabbit_host => '127.0.0.1', + :rabbit_port => 5672, + :rabbit_userid => 'guest', + :rabbit_password => '', + :rabbit_virtual_host => '/', + :rabbit_use_ssl => true, + :kombu_ssl_ca_certs => 'ca goes here', + :kombu_ssl_keyfile => 'key goes here', + :kombu_ssl_version => 'TLSv1', + :kombu_reconnect_delay => '1.0', + :kombu_failover_strategy => 'shuffle', } end @@ -191,6 +194,7 @@ describe 'designate' do is_expected.to contain_designate_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true) is_expected.to contain_designate_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] ) is_expected.to contain_designate_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value( params[:kombu_reconnect_delay] ) + is_expected.to contain_designate_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value( params[:kombu_failover_strategy] ) is_expected.to contain_oslo__messaging__rabbit('designate_config').with( :rabbit_use_ssl => params[:rabbit_use_ssl], :kombu_ssl_ca_certs => params[:kombu_ssl_ca_certs],