Support more [oslo_messaging_rabbit] parameters

The ceilometer middleware uses these options when creating notification
client instances.

Change-Id: I2a1d8e2d559bda4fda229f40aec7d97d14b10b11
This commit is contained in:
Takashi Kajinami 2022-08-09 17:49:30 +09:00
parent 224184aad0
commit 67454cf7ff
3 changed files with 134 additions and 37 deletions

View File

@ -91,7 +91,7 @@
# Defaults to $::os_service_default.
#
# [*rabbit_use_ssl*]
# (optional) Boolean. Connect over SSL for RabbitMQ. (boolean value)
# (Optional) Connect over SSL for RabbitMQ. (boolean value)
# Defaults to $::os_service_default
#
# [*kombu_ssl_version*]
@ -100,6 +100,57 @@
# available on some distributions. (string value)
# Defaults to $::os_service_default
#
# [*rabbit_ha_queues*]
# (Optional) Use HA queues in RabbitMQ (x-ha-policy: all). If you change this
# option, you must wipe the RabbitMQ database. (boolean value)
# Defaults to $::os_service_default
#
# [*rabbit_heartbeat_timeout_threshold*]
# (Optional) Number of seconds after which the Rabbit broker is
# considered down if heartbeat's keep-alive fails
# (0 disable the heartbeat). EXPERIMENTAL. (integer value)
# Defaults to $::os_service_default
#
# [*rabbit_heartbeat_rate*]
# (Optional) How often times during the heartbeat_timeout_threshold
# we check the heartbeat. (integer value)
# Defaults to $::os_service_default
#
# [*rabbit_heartbeat_in_pthread*]
# (Optional) EXPERIMENTAL: Run the health check heartbeat thread
# through a native python thread. By default if this
# option isn't provided the health check heartbeat will
# inherit the execution model from the parent process. By
# example if the parent process have monkey patched the
# stdlib by using eventlet/greenlet then the heartbeat
# will be run through a green thread.
# Defaults to $::os_service_default
#
# [*rabbit_qos_prefetch_count*]
# (Optional) Specifies the number of messages to prefetch.
# Defaults to $::os_service_default
#
# [*amqp_durable_queues*]
# (optional) Define queues as "durable" to rabbitmq.
# Defaults to $::os_service_default
#
# [*kombu_reconnect_delay*]
# (Optional) How long to wait before reconnecting in response
# to an AMQP consumer cancel notification. (floating point value)
# Defaults to $::os_service_default
#
# [*kombu_failover_strategy*]
# (Optional) Determines how the next RabbitMQ node is chosen in case the one
# we are currently connected to becomes unavailable. Takes effect only if
# more than one RabbitMQ node is provided in config. (string value)
# Defaults to $::os_service_default
#
# [*kombu_compression*]
# (optional) Possible values are: gzip, bz2. If not set compression will not
# be used. This option may notbe available in future versions. EXPERIMENTAL.
# (string value)
# Defaults to $::os_service_default
#
# == DEPRECATED
#
# [*auth_uri*]
@ -121,31 +172,40 @@
# Copyright 2013 eNovance licensing@enovance.com
#
class swift::proxy::ceilometer(
$default_transport_url = undef,
$driver = $::os_service_default,
$topic = undef,
$control_exchange = undef,
$ensure = 'present',
$nonblocking_notify = false,
$ignore_projects = ['services'],
$auth_url = 'http://127.0.0.1:5000',
$auth_type = 'password',
$project_name = 'services',
$project_domain_name = 'Default',
$system_scope = $::os_service_default,
$username = 'swift',
$user_domain_name = 'Default',
$password = undef,
$region_name = $::os_service_default,
$notification_ssl_ca_file = $::os_service_default,
$notification_ssl_cert_file = $::os_service_default,
$notification_ssl_key_file = $::os_service_default,
$amqp_ssl_key_password = $::os_service_default,
$rabbit_use_ssl = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
$default_transport_url = undef,
$driver = $::os_service_default,
$topic = undef,
$control_exchange = undef,
$ensure = 'present',
$nonblocking_notify = false,
$ignore_projects = ['services'],
$auth_url = 'http://127.0.0.1:5000',
$auth_type = 'password',
$project_name = 'services',
$project_domain_name = 'Default',
$system_scope = $::os_service_default,
$username = 'swift',
$user_domain_name = 'Default',
$password = undef,
$region_name = $::os_service_default,
$notification_ssl_ca_file = $::os_service_default,
$notification_ssl_cert_file = $::os_service_default,
$notification_ssl_key_file = $::os_service_default,
$amqp_ssl_key_password = $::os_service_default,
$rabbit_use_ssl = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
$rabbit_ha_queues = $::os_service_default,
$rabbit_heartbeat_timeout_threshold = $::os_service_default,
$rabbit_heartbeat_rate = $::os_service_default,
$rabbit_heartbeat_in_pthread = $::os_service_default,
$rabbit_qos_prefetch_count = $::os_service_default,
$amqp_durable_queues = $::os_service_default,
$kombu_reconnect_delay = $::os_service_default,
$kombu_failover_strategy = $::os_service_default,
$kombu_compression = $::os_service_default,
# DEPRECATED PARAMETERS
$auth_uri = undef,
$group = undef,
$auth_uri = undef,
$group = undef,
) inherits swift {
include swift::deps
@ -198,15 +258,27 @@ Please set password parameter')
}
if $default_transport_url =~ /^rabbit.*/ {
oslo::messaging::rabbit {'swift_proxy_config':
kombu_ssl_ca_certs => $notification_ssl_ca_file,
kombu_ssl_certfile => $notification_ssl_cert_file,
kombu_ssl_keyfile => $notification_ssl_key_file,
kombu_ssl_version => $kombu_ssl_version,
rabbit_use_ssl => $rabbit_use_ssl,
oslo::messaging::rabbit { 'swift_proxy_config':
rabbit_ha_queues => $rabbit_ha_queues,
heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold,
heartbeat_rate => $rabbit_heartbeat_rate,
heartbeat_in_pthread => $rabbit_heartbeat_in_pthread,
rabbit_qos_prefetch_count => $rabbit_qos_prefetch_count,
amqp_durable_queues => $amqp_durable_queues,
kombu_ssl_ca_certs => $notification_ssl_ca_file,
kombu_ssl_certfile => $notification_ssl_cert_file,
kombu_ssl_keyfile => $notification_ssl_key_file,
kombu_ssl_version => $kombu_ssl_version,
rabbit_use_ssl => $rabbit_use_ssl,
kombu_reconnect_delay => $kombu_reconnect_delay,
kombu_failover_strategy => $kombu_failover_strategy,
kombu_compression => $kombu_compression,
}
oslo::messaging::amqp { 'swift_proxy_config': }
} elsif $default_transport_url =~ /^amqp.*/ {
oslo::messaging::amqp {'swift_proxy_config':
oslo::messaging::rabbit { 'swift_proxy_config': }
oslo::messaging::amqp { 'swift_proxy_config':
ssl_ca_file => $notification_ssl_ca_file,
ssl_cert_file => $notification_ssl_cert_file,
ssl_key_file => $notification_ssl_key_file,

View File

@ -0,0 +1,15 @@
---
features:
- |
The ``swift::proxy::ceilometer`` class now supports the following new
parameters to manage options for Rabbit driver in oslo.messaging library.
- ``rabbit_ha_queues``
- ``heartbeat_timeout_threshold``
- ``heartbeat_rate``
- ``heartbeat_in_pthread``
- ``rabbit_qos_prefetch_count``
- ``amqp_durable_queues``
- ``kombu_reconnect_delay``
- ``kombu_failover_strategy``
- ``kombu_compression``

View File

@ -75,12 +75,22 @@ describe 'swift::proxy::ceilometer' do
end
it { is_expected.to contain_oslo__messaging__rabbit('swift_proxy_config').with(
:rabbit_use_ssl => '<SERVICE DEFAULT>',
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
:kombu_ssl_version => '<SERVICE DEFAULT>',
:rabbit_ha_queues => '<SERVICE DEFAULT>',
:heartbeat_timeout_threshold => '<SERVICE DEFAULT>',
:heartbeat_rate => '<SERVICE DEFAULT>',
:heartbeat_in_pthread => '<SERVICE DEFAULT>',
:rabbit_qos_prefetch_count => '<SERVICE DEFAULT>',
:amqp_durable_queues => '<SERVICE DEFAULT>',
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
:kombu_ssl_version => '<SERVICE DEFAULT>',
:rabbit_use_ssl => '<SERVICE DEFAULT>',
:kombu_reconnect_delay => '<SERVICE DEFAULT>',
:kombu_failover_strategy => '<SERVICE DEFAULT>',
:kombu_compression => '<SERVICE DEFAULT>',
)}
it { is_expected.to contain_oslo__messaging__amqp('swift_proxy_config') }
context 'with overridden rabbit ssl params' do
before do