From abd3d52764dd92e9c85d63670186a9140ba5bdf4 Mon Sep 17 00:00:00 2001 From: Michael Polenchuk Date: Fri, 14 Aug 2015 14:29:20 +0300 Subject: [PATCH] Add kombu_reconnect_delay option How long to wait before reconnecting in response to an AMQP consumer cancel notification. Change-Id: Iceb43c27f6476e023cb816ed1f2eda998f1165f3 --- manifests/init.pp | 7 +++++++ spec/classes/nova_init_spec.rb | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 59a12d5a4..b0fd3f347 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -105,6 +105,11 @@ # available on some distributions. # Defaults to 'TLSv1' # +# [*kombu_reconnect_delay*] +# (optional) How long to wait before reconnecting in response to an AMQP +# consumer cancel notification. +# Defaults to '1.0' +# # [*amqp_durable_queues*] # (optional) Define queues as "durable" to rabbitmq. # Defaults to false @@ -289,6 +294,7 @@ class nova( $kombu_ssl_certfile = undef, $kombu_ssl_keyfile = undef, $kombu_ssl_version = 'TLSv1', + $kombu_reconnect_delay = '1.0', $amqp_durable_queues = false, $qpid_hostname = 'localhost', $qpid_port = '5672', @@ -481,6 +487,7 @@ class nova( 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; 'oslo_messaging_rabbit/heartbeat_timeout_threshold': value => $rabbit_heartbeat_timeout_threshold; 'oslo_messaging_rabbit/heartbeat_rate': value => $rabbit_heartbeat_rate; + 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $kombu_reconnect_delay; 'DEFAULT/amqp_durable_queues': value => $amqp_durable_queues; } diff --git a/spec/classes/nova_init_spec.rb b/spec/classes/nova_init_spec.rb index 32b218918..3e1720413 100644 --- a/spec/classes/nova_init_spec.rb +++ b/spec/classes/nova_init_spec.rb @@ -237,6 +237,7 @@ describe 'nova' do is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673,rabbit2:5674') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) + is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('1.0') is_expected.to contain_nova_config('DEFAULT/amqp_durable_queues').with_value(false) is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') @@ -256,10 +257,21 @@ describe 'nova' do is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_hosts').with_value('rabbit:5673') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) + is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('1.0') is_expected.to contain_nova_config('DEFAULT/amqp_durable_queues').with_value(false) end end + context 'with kombu_reconnect_delay set to 5.0' do + let :params do + { :kombu_reconnect_delay => '5.0' } + end + + it 'configures rabbit' do + is_expected.to contain_nova_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('5.0') + end + end + context 'with rabbit_ha_queues set to true' do let :params do { :rabbit_ha_queues => 'true' }