Add more rabbitmq options

Adds the rabbit_ha_queues, rabbit_heartbeat_timeout_threshold
and rabbit_heartbeat_rate parameters that is used to configure
oslo messaging.

Change-Id: Iaf5679283e56f112b15d8440f57d708b525bb024
This commit is contained in:
Tobias Urdin 2018-07-05 12:03:47 +02:00
parent 2d9f778634
commit c1a475e0c9
3 changed files with 67 additions and 28 deletions

View File

@ -39,6 +39,25 @@
# option.
# Defaults to $::os_service_default
#
# [*rabbit_ha_queues*]
# (Optional) Use HA queues in RabbitMQ.
# Defaults to $::os_service_default
#
# [*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 $::os_service_default
#
# [*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 $::os_service_default
#
# [*rabbit_use_ssl*]
# (Optional) Connect over SSL for rabbit
# Defaults to $::os_service_default
@ -73,20 +92,23 @@
# Defaults to false.
#
class magnum(
$package_ensure = 'present',
$notification_transport_url = $::os_service_default,
$notification_driver = $::os_service_default,
$notification_topics = $::os_service_default,
$default_transport_url = $::os_service_default,
$rpc_response_timeout = $::os_service_default,
$control_exchange = $::os_service_default,
$rabbit_use_ssl = $::os_service_default,
$kombu_ssl_ca_certs = $::os_service_default,
$kombu_ssl_certfile = $::os_service_default,
$kombu_ssl_keyfile = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
$kombu_failover_strategy = $::os_service_default,
$purge_config = false,
$package_ensure = 'present',
$notification_transport_url = $::os_service_default,
$notification_driver = $::os_service_default,
$notification_topics = $::os_service_default,
$default_transport_url = $::os_service_default,
$rpc_response_timeout = $::os_service_default,
$control_exchange = $::os_service_default,
$rabbit_ha_queues = $::os_service_default,
$rabbit_heartbeat_timeout_threshold = $::os_service_default,
$rabbit_heartbeat_rate = $::os_service_default,
$rabbit_use_ssl = $::os_service_default,
$kombu_ssl_ca_certs = $::os_service_default,
$kombu_ssl_certfile = $::os_service_default,
$kombu_ssl_keyfile = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
$kombu_failover_strategy = $::os_service_default,
$purge_config = false,
) {
include ::magnum::deps
@ -106,12 +128,15 @@ class magnum(
}
oslo::messaging::rabbit { 'magnum_config':
rabbit_use_ssl => $rabbit_use_ssl,
kombu_ssl_version => $kombu_ssl_version,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_failover_strategy => $kombu_failover_strategy,
heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold,
heartbeat_rate => $rabbit_heartbeat_rate,
rabbit_use_ssl => $rabbit_use_ssl,
kombu_ssl_version => $kombu_ssl_version,
kombu_ssl_keyfile => $kombu_ssl_keyfile,
kombu_ssl_certfile => $kombu_ssl_certfile,
kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
kombu_failover_strategy => $kombu_failover_strategy,
rabbit_ha_queues => $rabbit_ha_queues,
}
oslo::messaging::default { 'magnum_config':

View File

@ -0,0 +1,5 @@
---
features:
- |
Added new parameters magnum::rabbit_ha_queues, magnum::rabbit_heartbeat_timeout_threshold
and magnum::rabbit_heartbeat_rate.

View File

@ -36,6 +36,9 @@ describe 'magnum' do
is_expected.to contain_magnum_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('DEFAULT/control_exchange').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
end
it 'configures various things' do
@ -48,14 +51,17 @@ describe 'magnum' do
context 'with overridden parameters' do
let :params do
{ :package_ensure => 'latest',
:notification_transport_url => 'rabbit://user:pass@host:1234/virt',
:notification_topics => 'openstack',
:notification_driver => 'messagingv1',
:default_transport_url => 'rabbit://user:pass@host:1234/virt',
:rpc_response_timeout => '120',
:control_exchange => 'magnum',
:kombu_failover_strategy => 'shuffle',
{ :package_ensure => 'latest',
:notification_transport_url => 'rabbit://user:pass@host:1234/virt',
:notification_topics => 'openstack',
:notification_driver => 'messagingv1',
:default_transport_url => 'rabbit://user:pass@host:1234/virt',
:rpc_response_timeout => '120',
:control_exchange => 'magnum',
:kombu_failover_strategy => 'shuffle',
:rabbit_ha_queues => true,
:rabbit_heartbeat_timeout_threshold => 60,
:rabbit_heartbeat_rate => 10,
}
end
@ -72,6 +78,9 @@ describe 'magnum' do
is_expected.to contain_magnum_config('DEFAULT/rpc_response_timeout').with_value('120')
is_expected.to contain_magnum_config('DEFAULT/control_exchange').with_value('magnum')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('shuffle')
is_expected.to contain_magnum_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true)
is_expected.to contain_magnum_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value(60)
is_expected.to contain_magnum_config('oslo_messaging_rabbit/heartbeat_rate').with_value(10)
end
it 'configures various things' do