Merge "Add support for RabbitMQ connection heartbeat"
This commit is contained in:
commit
58afd380d1
@ -41,6 +41,22 @@
|
||||
# password to connect to the rabbit_server. Optional. Defaults to empty.
|
||||
# [*rabbit_virtual_host*]
|
||||
# virtualhost 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*]
|
||||
# (optional) Connect over SSL for RabbitMQ
|
||||
# Defaults to false
|
||||
@ -75,39 +91,41 @@
|
||||
# (optional) various QPID options
|
||||
#
|
||||
class ceilometer(
|
||||
$metering_secret = false,
|
||||
$notification_topics = ['notifications'],
|
||||
$package_ensure = 'present',
|
||||
$debug = false,
|
||||
$log_dir = '/var/log/ceilometer',
|
||||
$verbose = false,
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$rpc_backend = 'ceilometer.openstack.common.rpc.impl_kombu',
|
||||
$rabbit_host = '127.0.0.1',
|
||||
$rabbit_port = 5672,
|
||||
$rabbit_hosts = undef,
|
||||
$rabbit_userid = 'guest',
|
||||
$rabbit_password = '',
|
||||
$rabbit_virtual_host = '/',
|
||||
$rabbit_use_ssl = false,
|
||||
$kombu_ssl_ca_certs = undef,
|
||||
$kombu_ssl_certfile = undef,
|
||||
$kombu_ssl_keyfile = undef,
|
||||
$kombu_ssl_version = 'TLSv1',
|
||||
$qpid_hostname = 'localhost',
|
||||
$qpid_port = 5672,
|
||||
$qpid_username = 'guest',
|
||||
$qpid_password = 'guest',
|
||||
$qpid_heartbeat = 60,
|
||||
$qpid_protocol = 'tcp',
|
||||
$qpid_tcp_nodelay = true,
|
||||
$qpid_reconnect = true,
|
||||
$qpid_reconnect_timeout = 0,
|
||||
$qpid_reconnect_limit = 0,
|
||||
$qpid_reconnect_interval_min = 0,
|
||||
$qpid_reconnect_interval_max = 0,
|
||||
$qpid_reconnect_interval = 0
|
||||
$metering_secret = false,
|
||||
$notification_topics = ['notifications'],
|
||||
$package_ensure = 'present',
|
||||
$debug = false,
|
||||
$log_dir = '/var/log/ceilometer',
|
||||
$verbose = false,
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$rpc_backend = 'ceilometer.openstack.common.rpc.impl_kombu',
|
||||
$rabbit_host = '127.0.0.1',
|
||||
$rabbit_port = 5672,
|
||||
$rabbit_hosts = undef,
|
||||
$rabbit_userid = 'guest',
|
||||
$rabbit_password = '',
|
||||
$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,
|
||||
$kombu_ssl_keyfile = undef,
|
||||
$kombu_ssl_version = 'TLSv1',
|
||||
$qpid_hostname = 'localhost',
|
||||
$qpid_port = 5672,
|
||||
$qpid_username = 'guest',
|
||||
$qpid_password = 'guest',
|
||||
$qpid_heartbeat = 60,
|
||||
$qpid_protocol = 'tcp',
|
||||
$qpid_tcp_nodelay = true,
|
||||
$qpid_reconnect = true,
|
||||
$qpid_reconnect_timeout = 0,
|
||||
$qpid_reconnect_limit = 0,
|
||||
$qpid_reconnect_interval_min = 0,
|
||||
$qpid_reconnect_interval_max = 0,
|
||||
$qpid_reconnect_interval = 0,
|
||||
) {
|
||||
|
||||
validate_string($metering_secret)
|
||||
@ -187,10 +205,12 @@ class ceilometer(
|
||||
}
|
||||
|
||||
ceilometer_config {
|
||||
'oslo_messaging_rabbit/rabbit_userid' : value => $rabbit_userid;
|
||||
'oslo_messaging_rabbit/rabbit_password' : value => $rabbit_password, secret => true;
|
||||
'oslo_messaging_rabbit/rabbit_virtual_host' : value => $rabbit_virtual_host;
|
||||
'oslo_messaging_rabbit/rabbit_use_ssl' : value => $rabbit_use_ssl;
|
||||
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid;
|
||||
'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true;
|
||||
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host;
|
||||
'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;
|
||||
}
|
||||
|
||||
if $rabbit_use_ssl {
|
||||
|
@ -39,6 +39,7 @@ describe 'ceilometer' do
|
||||
it_configures 'a ceilometer base installation'
|
||||
it_configures 'rabbit with SSL support'
|
||||
it_configures 'rabbit without HA support (with backward compatibility)'
|
||||
it_configures 'rabbit with connection heartbeats'
|
||||
end
|
||||
|
||||
context 'with rabbit_hosts parameter' do
|
||||
@ -178,6 +179,8 @@ describe 'ceilometer' do
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] )
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0')
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2')
|
||||
end
|
||||
|
||||
it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_host').with_value( params[:rabbit_host] ) }
|
||||
@ -194,6 +197,8 @@ describe 'ceilometer' do
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] )
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0')
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2')
|
||||
end
|
||||
|
||||
it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_host').with_ensure('absent') }
|
||||
@ -210,6 +215,8 @@ describe 'ceilometer' do
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] )
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0')
|
||||
is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2')
|
||||
end
|
||||
|
||||
it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_host').with_ensure('absent') }
|
||||
@ -219,6 +226,18 @@ describe 'ceilometer' do
|
||||
|
||||
end
|
||||
|
||||
shared_examples_for 'rabbit with connection heartbeats' do
|
||||
context "with heartbeat configuration" do
|
||||
before { params.merge!(
|
||||
:rabbit_heartbeat_timeout_threshold => '60',
|
||||
:rabbit_heartbeat_rate => '10'
|
||||
) }
|
||||
|
||||
it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') }
|
||||
it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') }
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'rabbit with SSL support' do
|
||||
context "with default parameters" do
|
||||
it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false') }
|
||||
|
Loading…
x
Reference in New Issue
Block a user