Merge "Add support for RabbitMQ connection heartbeat"

This commit is contained in:
Jenkins
2015-07-13 16:28:12 +00:00
committed by Gerrit Code Review
2 changed files with 106 additions and 81 deletions

View File

@@ -72,6 +72,21 @@
# (optional) Use HA queues in RabbitMQ. # (optional) Use HA queues in RabbitMQ.
# Defaults to undef # Defaults to undef
# #
# [*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
#
# [*kombu_ssl_ca_certs*] # [*kombu_ssl_ca_certs*]
# (optional) SSL certification authority file (valid only if SSL enabled). # (optional) SSL certification authority file (valid only if SSL enabled).
# Defaults to undef # Defaults to undef
@@ -246,64 +261,66 @@
# Defaults to undef # Defaults to undef
# #
class nova( class nova(
$ensure_package = 'present', $ensure_package = 'present',
$database_connection = false, $database_connection = false,
$slave_connection = false, $slave_connection = false,
$database_idle_timeout = 3600, $database_idle_timeout = 3600,
$rpc_backend = 'rabbit', $rpc_backend = 'rabbit',
$image_service = 'nova.image.glance.GlanceImageService', $image_service = 'nova.image.glance.GlanceImageService',
# these glance params should be optional # these glance params should be optional
# this should probably just be configured as a glance client # this should probably just be configured as a glance client
$glance_api_servers = 'localhost:9292', $glance_api_servers = 'localhost:9292',
$memcached_servers = false, $memcached_servers = false,
$rabbit_host = 'localhost', $rabbit_host = 'localhost',
$rabbit_hosts = false, $rabbit_hosts = false,
$rabbit_password = 'guest', $rabbit_password = 'guest',
$rabbit_port = '5672', $rabbit_port = '5672',
$rabbit_userid = 'guest', $rabbit_userid = 'guest',
$rabbit_virtual_host = '/', $rabbit_virtual_host = '/',
$rabbit_use_ssl = false, $rabbit_use_ssl = false,
$rabbit_ha_queues = undef, $rabbit_heartbeat_timeout_threshold = 0,
$kombu_ssl_ca_certs = undef, $rabbit_heartbeat_rate = 2,
$kombu_ssl_certfile = undef, $rabbit_ha_queues = undef,
$kombu_ssl_keyfile = undef, $kombu_ssl_ca_certs = undef,
$kombu_ssl_version = 'TLSv1', $kombu_ssl_certfile = undef,
$amqp_durable_queues = false, $kombu_ssl_keyfile = undef,
$qpid_hostname = 'localhost', $kombu_ssl_version = 'TLSv1',
$qpid_port = '5672', $amqp_durable_queues = false,
$qpid_username = 'guest', $qpid_hostname = 'localhost',
$qpid_password = 'guest', $qpid_port = '5672',
$qpid_sasl_mechanisms = false, $qpid_username = 'guest',
$qpid_heartbeat = 60, $qpid_password = 'guest',
$qpid_protocol = 'tcp', $qpid_sasl_mechanisms = false,
$qpid_tcp_nodelay = true, $qpid_heartbeat = 60,
$auth_strategy = 'keystone', $qpid_protocol = 'tcp',
$service_down_time = 60, $qpid_tcp_nodelay = true,
$log_dir = '/var/log/nova', $auth_strategy = 'keystone',
$state_path = '/var/lib/nova', $service_down_time = 60,
$lock_path = $::nova::params::lock_path, $log_dir = '/var/log/nova',
$verbose = false, $state_path = '/var/lib/nova',
$debug = false, $lock_path = $::nova::params::lock_path,
$periodic_interval = '60', $verbose = false,
$report_interval = '10', $debug = false,
$rootwrap_config = '/etc/nova/rootwrap.conf', $periodic_interval = '60',
$use_ssl = false, $report_interval = '10',
$enabled_ssl_apis = ['ec2', 'metadata', 'osapi_compute'], $rootwrap_config = '/etc/nova/rootwrap.conf',
$ca_file = false, $use_ssl = false,
$cert_file = false, $enabled_ssl_apis = ['ec2', 'metadata', 'osapi_compute'],
$key_file = false, $ca_file = false,
$nova_public_key = undef, $cert_file = false,
$nova_private_key = undef, $key_file = false,
$use_syslog = false, $nova_public_key = undef,
$log_facility = 'LOG_USER', $nova_private_key = undef,
$install_utilities = true, $use_syslog = false,
$notification_driver = [], $log_facility = 'LOG_USER',
$notification_topics = 'notifications', $install_utilities = true,
$notify_api_faults = false, $notification_driver = [],
$notify_on_state_change = undef, $notification_topics = 'notifications',
$notify_api_faults = false,
$notify_on_state_change = undef,
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
$mysql_module = undef, $mysql_module = undef,
$os_region_name = undef, $os_region_name = undef,
) inherits nova::params { ) inherits nova::params {
# maintain backward compatibility # maintain backward compatibility
@@ -459,11 +476,13 @@ class nova(
if $rpc_backend == 'nova.openstack.common.rpc.impl_kombu' or $rpc_backend == 'rabbit' { if $rpc_backend == 'nova.openstack.common.rpc.impl_kombu' or $rpc_backend == 'rabbit' {
# I may want to support exporting and collecting these # I may want to support exporting and collecting these
nova_config { nova_config {
'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; 'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true;
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid; 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid;
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; 'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host;
'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; 'oslo_messaging_rabbit/heartbeat_timeout_threshold': value => $rabbit_heartbeat_timeout_threshold;
'oslo_messaging_rabbit/heartbeat_rate': value => $rabbit_heartbeat_rate;
'DEFAULT/amqp_durable_queues': value => $amqp_durable_queues;
} }
if $rabbit_use_ssl { if $rabbit_use_ssl {

View File

@@ -62,6 +62,8 @@ describe 'nova' do
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('5672')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/')
is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0')
is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2')
end end
it 'configures various things' do it 'configures various things' do
@@ -88,27 +90,29 @@ describe 'nova' do
context 'with overridden parameters' do context 'with overridden parameters' do
let :params do let :params do
{ :verbose => true, { :verbose => true,
:debug => true, :debug => true,
:log_dir => '/var/log/nova2', :log_dir => '/var/log/nova2',
:image_service => 'nova.image.local.LocalImageService', :image_service => 'nova.image.local.LocalImageService',
:rabbit_host => 'rabbit', :rabbit_host => 'rabbit',
:rabbit_userid => 'rabbit_user', :rabbit_userid => 'rabbit_user',
:rabbit_port => '5673', :rabbit_port => '5673',
:rabbit_password => 'password', :rabbit_password => 'password',
:rabbit_ha_queues => 'undef', :rabbit_ha_queues => 'undef',
:lock_path => '/var/locky/path', :rabbit_heartbeat_timeout_threshold => '60',
:state_path => '/var/lib/nova2', :rabbit_heartbeat_rate => '10',
:service_down_time => '120', :lock_path => '/var/locky/path',
:auth_strategy => 'foo', :state_path => '/var/lib/nova2',
:ensure_package => '2012.1.1-15.el6', :service_down_time => '120',
:memcached_servers => ['memcached01:11211', 'memcached02:11211'], :auth_strategy => 'foo',
:install_utilities => false, :ensure_package => '2012.1.1-15.el6',
:notification_driver => 'ceilometer.compute.nova_notifier', :memcached_servers => ['memcached01:11211', 'memcached02:11211'],
:notification_topics => 'openstack', :install_utilities => false,
:notify_api_faults => true, :notification_driver => 'ceilometer.compute.nova_notifier',
:report_interval => '60', :notification_topics => 'openstack',
:os_region_name => 'MyRegion' } :notify_api_faults => true,
:report_interval => '60',
:os_region_name => 'MyRegion' }
end end
it 'installs packages' do it 'installs packages' do
@@ -133,6 +137,8 @@ describe 'nova' do
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_port').with_value('5673')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_userid').with_value('rabbit_user') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_userid').with_value('rabbit_user')
is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') is_expected.to contain_nova_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/')
is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60')
is_expected.to contain_nova_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10')
end end
it 'configures memcached_servers' do it 'configures memcached_servers' do