Merge "Add support for RabbitMQ connection heartbeat" into stable/kilo

This commit is contained in:
Jenkins 2015-12-10 17:17:10 +00:00 committed by Gerrit Code Review
commit 59d4821b04
2 changed files with 48 additions and 15 deletions

View File

@ -21,6 +21,21 @@
# [*rabbit_virtual_host*] # [*rabbit_virtual_host*]
# virtual_host to use. Optional. Defaults to '/' # virtual_host to use. Optional. Defaults to '/'
# #
# [*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
@ -61,21 +76,23 @@
class glance::notify::rabbitmq( class glance::notify::rabbitmq(
$rabbit_password, $rabbit_password,
$rabbit_userid = 'guest', $rabbit_userid = 'guest',
$rabbit_host = 'localhost', $rabbit_host = 'localhost',
$rabbit_port = '5672', $rabbit_port = '5672',
$rabbit_hosts = false, $rabbit_hosts = false,
$rabbit_virtual_host = '/', $rabbit_virtual_host = '/',
$rabbit_use_ssl = false, $rabbit_heartbeat_timeout_threshold = 0,
$kombu_ssl_ca_certs = undef, $rabbit_heartbeat_rate = 2,
$kombu_ssl_certfile = undef, $rabbit_use_ssl = false,
$kombu_ssl_keyfile = undef, $kombu_ssl_ca_certs = undef,
$kombu_ssl_version = 'TLSv1', $kombu_ssl_certfile = undef,
$rabbit_notification_exchange = 'glance', $kombu_ssl_keyfile = undef,
$rabbit_notification_topic = 'notifications', $kombu_ssl_version = 'TLSv1',
$rabbit_durable_queues = false, $rabbit_notification_exchange = 'glance',
$amqp_durable_queues = false, $rabbit_notification_topic = 'notifications',
$notification_driver = 'messaging', $rabbit_durable_queues = false,
$amqp_durable_queues = false,
$notification_driver = 'messaging',
) { ) {
if $rabbit_durable_queues { if $rabbit_durable_queues {
@ -106,6 +123,8 @@ class glance::notify::rabbitmq(
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid; 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid;
'oslo_messaging_rabbit/rabbit_notification_exchange': value => $rabbit_notification_exchange; 'oslo_messaging_rabbit/rabbit_notification_exchange': value => $rabbit_notification_exchange;
'oslo_messaging_rabbit/rabbit_notification_topic': value => $rabbit_notification_topic; 'oslo_messaging_rabbit/rabbit_notification_topic': value => $rabbit_notification_topic;
'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;
'DEFAULT/amqp_durable_queues': value => $amqp_durable_queues_real; 'DEFAULT/amqp_durable_queues': value => $amqp_durable_queues_real;
} }

View File

@ -26,6 +26,8 @@ describe 'glance::notify::rabbitmq' do
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_exchange').with_value('glance') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_exchange').with_value('glance') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_topic').with_value('notifications') } it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_topic').with_value('notifications') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2') }
end end
describe 'when passing params and use ssl' do describe 'when passing params and use ssl' do
@ -122,6 +124,18 @@ describe 'glance::notify::rabbitmq' do
it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_host') } it { is_expected.to_not contain_glance_api_config('oslo_messaging_rabbit/rabbit_host') }
end end
describe 'when passing params for rabbitmq heartbeat' do
let :params do
{
:rabbit_password => 'pass',
:rabbit_heartbeat_timeout_threshold => '60',
:rabbit_heartbeat_rate => '10',
}
end
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') }
end
describe 'when using deprecated params' do describe 'when using deprecated params' do
let :params do let :params do
{ {