From e9662c9daadb2e2a987bcad2f7082f48c0ad0335 Mon Sep 17 00:00:00 2001 From: iberezovskiy Date: Wed, 11 May 2016 20:19:51 +0300 Subject: [PATCH] Add kombu_failover_strategy and kombu_compression options Change-Id: I438f1abe9ddd1074add95bba8752f516b15eaba3 --- manifests/init.pp | 55 +++++++++++++++++++++----------- spec/classes/sahara_init_spec.rb | 21 ++++++++---- 2 files changed, 51 insertions(+), 25 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 2ebb95b9..87cb6ed1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -233,7 +233,20 @@ # # [*kombu_reconnect_delay*] # (Optional) Backoff on cancel notification (valid only if SSL enabled). -# Defaults to '1.0'; floating-point value. +# (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. +# +# [*kombu_compression*] +# (optional) Possible values are: gzip, bz2. If not set compression will not +# be used. This option may notbe available in future versions. EXPERIMENTAL. +# (string value) +# Defaults to $::os_service_default. # # == DEPRECATED PARAMETERS # @@ -296,6 +309,8 @@ class sahara( $kombu_ssl_certfile = $::os_service_default, $kombu_ssl_ca_certs = $::os_service_default, $kombu_reconnect_delay = $::os_service_default, + $kombu_failover_strategy = $::os_service_default, + $kombu_compression = $::os_service_default, # DEPRECATED PARAMETERS $zeromq_port = undef, ) { @@ -334,24 +349,26 @@ class sahara( if $rpc_backend == 'rabbit' or is_service_default($rpc_backend) { oslo::messaging::rabbit { 'sahara_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_ha_queues => $rabbit_ha_queues, - rabbit_use_ssl => $rabbit_use_ssl, - kombu_reconnect_delay => $kombu_reconnect_delay, - 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, - amqp_durable_queues => $amqp_durable_queues, - rabbit_login_method => $rabbit_login_method, - rabbit_retry_interval => $rabbit_retry_interval, - rabbit_retry_backoff => $rabbit_retry_backoff, - rabbit_max_retries => $rabbit_max_retries, + 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_ha_queues => $rabbit_ha_queues, + rabbit_use_ssl => $rabbit_use_ssl, + kombu_failover_strategy => $kombu_failover_strategy, + kombu_compression => $kombu_compression, + kombu_reconnect_delay => $kombu_reconnect_delay, + 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, + amqp_durable_queues => $amqp_durable_queues, + rabbit_login_method => $rabbit_login_method, + rabbit_retry_interval => $rabbit_retry_interval, + rabbit_retry_backoff => $rabbit_retry_backoff, + rabbit_max_retries => $rabbit_max_retries, } } diff --git a/spec/classes/sahara_init_spec.rb b/spec/classes/sahara_init_spec.rb index 1b36a199..431cf1a4 100644 --- a/spec/classes/sahara_init_spec.rb +++ b/spec/classes/sahara_init_spec.rb @@ -32,6 +32,9 @@ describe 'sahara' do it { is_expected.to contain_sahara_config('keystone_authtoken/admin_tenant_name').with_value('services') } it { is_expected.to contain_sahara_config('keystone_authtoken/admin_password').with_value('secrete').with_secret(true) } it { is_expected.to contain_sahara_config('DEFAULT/plugins').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_compression').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('') } end context 'with passing params' do @@ -82,12 +85,15 @@ describe 'sahara' do context 'when passing params' do before do params.merge!({ - :rabbit_password => 'pass', - :rabbit_userid => 'guest2', - :rabbit_host => 'localhost2', - :rabbit_port => '5673', - :rabbit_ha_queues => 'true', - :amqp_durable_queues => 'true', + :rabbit_password => 'pass', + :rabbit_userid => 'guest2', + :rabbit_host => 'localhost2', + :rabbit_port => '5673', + :rabbit_ha_queues => 'true', + :amqp_durable_queues => 'true', + :kombu_reconnect_delay => '1.0', + :kombu_compression => 'gzip', + :kombu_failover_strategy => 'round-robin', }) end @@ -98,6 +104,9 @@ describe 'sahara' do it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('1.0') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_compression').with_value('gzip') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('round-robin') } end context 'with rabbit ssl cert parameters' do