Introduce the new rabbit_heartbeat_in_pthread option

oslo.messaging RabbitMQ driver have now a new option that allow user to
run the RabbitMQ heartbeat over a native python thread.

These change allow user to use this new option.

Change-Id: I3e4d9da942b352d446613c7241539f564b753d64
Closes-Bug: #1840868
This commit is contained in:
ZhongShengping 2019-08-21 14:21:01 +08:00
parent d4c44694e5
commit 521337906e
3 changed files with 43 additions and 22 deletions

View File

@ -50,6 +50,16 @@
# option, you must wipe the RabbitMQ database. (boolean 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
#
# [*kombu_ssl_ca_certs*]
# (optional) SSL certification authority file (valid only if SSL enabled).
# Defaults to $::os_service_default
@ -101,26 +111,27 @@
# Defaults to $::os_service_default.
#
class designate(
$package_ensure = present,
$common_package_name = $::designate::params::common_package_name,
$root_helper = 'sudo designate-rootwrap /etc/designate/rootwrap.conf',
$notification_transport_url = $::os_service_default,
$rabbit_use_ssl = false,
$rabbit_ha_queues = $::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_reconnect_delay = $::os_service_default,
$kombu_failover_strategy = $::os_service_default,
$notification_driver = 'messaging',
$default_transport_url = $::os_service_default,
$rpc_response_timeout = $::os_service_default,
$control_exchange = $::os_service_default,
$notification_topics = 'notifications',
$purge_config = false,
$amqp_durable_queues = $::os_service_default,
$neutron_endpoint_type = $::os_service_default,
$package_ensure = present,
$common_package_name = $::designate::params::common_package_name,
$root_helper = 'sudo designate-rootwrap /etc/designate/rootwrap.conf',
$notification_transport_url = $::os_service_default,
$rabbit_use_ssl = false,
$rabbit_ha_queues = $::os_service_default,
$rabbit_heartbeat_in_pthread = $::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_reconnect_delay = $::os_service_default,
$kombu_failover_strategy = $::os_service_default,
$notification_driver = 'messaging',
$default_transport_url = $::os_service_default,
$rpc_response_timeout = $::os_service_default,
$control_exchange = $::os_service_default,
$notification_topics = 'notifications',
$purge_config = false,
$amqp_durable_queues = $::os_service_default,
$neutron_endpoint_type = $::os_service_default,
) inherits designate::params {
if !is_service_default($kombu_ssl_ca_certs) and !$rabbit_use_ssl {
@ -165,6 +176,7 @@ class designate(
kombu_failover_strategy => $kombu_failover_strategy,
rabbit_use_ssl => $rabbit_use_ssl,
rabbit_ha_queues => $rabbit_ha_queues,
heartbeat_in_pthread => $rabbit_heartbeat_in_pthread,
amqp_durable_queues => $amqp_durable_queues,
}

View File

@ -0,0 +1,6 @@
---
features:
- |
Allow users to run the RabbitMQ heartbeat over a native python thread in the
oslo.messaging RabbitMQ driver, by using the `rabbit_heartbeat_in_pthread`
option in configuration.

View File

@ -103,6 +103,7 @@ describe 'designate' do
is_expected.to contain_designate_config('oslo_messaging_notifications/driver').with_value('messaging' )
is_expected.to contain_designate_config('oslo_messaging_notifications/topics').with_value('notifications')
is_expected.to contain_designate_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_designate_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('<SERVICE DEFAULT>')
is_expected.to contain_designate_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_designate_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_designate_config('DEFAULT/control_exchange').with_value('<SERVICE DEFAULT>')
@ -113,13 +114,15 @@ describe 'designate' do
shared_examples_for 'rabbit transport' do
before do
params.merge!({
:default_transport_url => 'rabbit://designate:secret@127.0.0.1:5672/designate',
:rabbit_ha_queues => true,
:default_transport_url => 'rabbit://designate:secret@127.0.0.1:5672/designate',
:rabbit_ha_queues => true,
:rabbit_heartbeat_in_pthread => true,
})
end
it { is_expected.to contain_designate_config('DEFAULT/transport_url').with_value('rabbit://designate:secret@127.0.0.1:5672/designate') }
it { is_expected.to contain_designate_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) }
it { is_expected.to contain_designate_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value(true) }
it { is_expected.to contain_designate_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('<SERVICE DEFAULT>') }
end