Add RabbitMQ connection heartbeat options to Neutron module

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

For Neutron heartbeat_timeout_threshold should be set to 0
(this is the default value)

Upstream patch: I44ec6712d93dac497ab832cb0aa18da508778d16 (merged)
Closes-bug: #1477689
Related-bug: #1430894
Related-bug: #1410797

Change-Id: I5810c71a3de5123a43852e37e481d35f5f174ac8
This commit is contained in:
Sergey Kolekonov 2015-07-23 18:27:26 +03:00
parent 8034788f30
commit ac0718c113
2 changed files with 97 additions and 66 deletions

View File

@ -131,6 +131,21 @@
# multiple RabbitMQ Brokers.
# 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*]
# (optional) Connect over SSL for RabbitMQ
# Defaults to false
@ -251,6 +266,8 @@ class neutron (
$rabbit_port = '5672',
$rabbit_user = 'guest',
$rabbit_virtual_host = '/',
$rabbit_heartbeat_timeout_threshold = 0,
$rabbit_heartbeat_rate = 2,
$rabbit_use_ssl = false,
$kombu_ssl_ca_certs = undef,
$kombu_ssl_certfile = undef,
@ -428,6 +445,8 @@ class neutron (
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_user;
'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true;
'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/kombu_reconnect_delay': value => $kombu_reconnect_delay;
}

View File

@ -56,6 +56,11 @@ describe 'neutron' do
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 without kombu'
it_configures 'with SSL disabled'
@ -156,6 +161,13 @@ describe 'neutron' do
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
before do
params.merge!(