Add support for RabbitMQ connection heartbeat

Kilo oslo.messaging added heartbeating support for RabbitMQ
connections.  This patch adds support for this in Puppet modules
by managing the oslo_messaging_rabbit/heartbeat_timeout_threshold
and oslo_messaging_rabbit/heartbeat_rate settings.

Change-Id: I44ec6712d93dac497ab832cb0aa18da508778d16
Closes-bug: 1467667
This commit is contained in:
Mike Dorman
2015-06-22 15:06:35 -06:00
parent e2fb846dfe
commit e1a39766dd
2 changed files with 98 additions and 65 deletions

View File

@@ -121,6 +121,21 @@
# multiple RabbitMQ Brokers. # multiple RabbitMQ Brokers.
# Defaults to false # Defaults to false
# #
# [*rabbit_heartbeat_timeout_threshold*]
# (optional) Number of seconds after which the RabbitMQ broker is considered
# down if the heartbeat keepalive fails. Any value >0 enables heartbeats.
# Heartbeating helps to ensure the TCP connection to RabbitMQ isn't silently
# closed, resulting in missed or lost messages from the queue.
# (Requires kombu >= 3.0.7 and amqp >= 1.4.0)
# Defaults to 0
#
# [*rabbit_heartbeat_rate*]
# (optional) How often during the rabbit_heartbeat_timeout_threshold period to
# check the heartbeat on RabbitMQ connection. (i.e. rabbit_heartbeat_rate=2
# when rabbit_heartbeat_timeout_threshold=60, the heartbeat will be checked
# every 30 seconds.
# Defaults to 2
#
# [*rabbit_use_ssl*] # [*rabbit_use_ssl*]
# (optional) Connect over SSL for RabbitMQ # (optional) Connect over SSL for RabbitMQ
# Defaults to false # Defaults to false
@@ -240,6 +255,8 @@ class neutron (
$rabbit_port = '5672', $rabbit_port = '5672',
$rabbit_user = 'guest', $rabbit_user = 'guest',
$rabbit_virtual_host = '/', $rabbit_virtual_host = '/',
$rabbit_heartbeat_timeout_threshold = 0,
$rabbit_heartbeat_rate = 2,
$rabbit_use_ssl = false, $rabbit_use_ssl = false,
$kombu_ssl_ca_certs = undef, $kombu_ssl_ca_certs = undef,
$kombu_ssl_certfile = undef, $kombu_ssl_certfile = undef,
@@ -416,6 +433,8 @@ class neutron (
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_user; 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_user;
'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; 'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true;
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; 'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host;
'oslo_messaging_rabbit/heartbeat_timeout_threshold': value => $rabbit_heartbeat_timeout_threshold;
'oslo_messaging_rabbit/heartbeat_rate': value => $rabbit_heartbeat_rate;
'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl;
'oslo_messaging_rabbit/kombu_reconnect_delay': value => $kombu_reconnect_delay; 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $kombu_reconnect_delay;
} }

View File

@@ -56,6 +56,11 @@ describe 'neutron' do
end end
context 'with rabbitmq heartbeat configured' do
before { params.merge!( :rabbit_heartbeat_timeout_threshold => '60', :rabbit_heartbeat_rate => '10' ) }
it_configures 'rabbit with heartbeat configured'
end
it_configures 'with SSL enabled with kombu' it_configures 'with SSL enabled with kombu'
it_configures 'with SSL enabled without kombu' it_configures 'with SSL enabled without kombu'
it_configures 'with SSL disabled' it_configures 'with SSL disabled'
@@ -109,6 +114,8 @@ describe 'neutron' do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] ) is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] )
is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_password').with_secret( true ) is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_password').with_secret( true )
is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] ) is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
is_expected.to contain_neutron_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value( params[:kombu_reconnect_delay] ) is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value( params[:kombu_reconnect_delay] )
end end
@@ -155,6 +162,13 @@ describe 'neutron' do
end end
end end
shared_examples_for 'rabbit with heartbeat configured' do
it 'in neutron.conf' do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10')
end
end
shared_examples_for 'with SSL socket options set' do shared_examples_for 'with SSL socket options set' do
before do before do
params.merge!( params.merge!(