Introduce the new `heartbeat_in_pthread` oslo.messaging option.

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

These change allow user to use this new option.

For further reading:
https://review.opendev.org/#/c/663074/

Change-Id: If5fb021a6864abbe95f4d23281484cb859537f3b
This commit is contained in:
Hervé Beraud 2019-08-08 18:39:53 +02:00
parent e69e317002
commit 23eb13c6c8
3 changed files with 21 additions and 0 deletions

View File

@ -103,6 +103,16 @@
# we check the heartbeat. (integer value)
# Defaults to $::os_service_default
#
# [*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
#
define oslo::messaging::rabbit(
$amqp_durable_queues = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
@ -123,6 +133,7 @@ define oslo::messaging::rabbit(
$rabbit_transient_queues_ttl = $::os_service_default,
$heartbeat_timeout_threshold = $::os_service_default,
$heartbeat_rate = $::os_service_default,
$heartbeat_in_pthread = $::os_service_default,
){
if $rabbit_use_ssl != true {
@ -146,6 +157,7 @@ define oslo::messaging::rabbit(
$rabbit_options = { 'oslo_messaging_rabbit/amqp_durable_queues' => { value => $amqp_durable_queues },
'oslo_messaging_rabbit/heartbeat_rate' => { value => $heartbeat_rate },
'oslo_messaging_rabbit/heartbeat_in_pthread' => { value => $heartbeat_in_pthread },
'oslo_messaging_rabbit/heartbeat_timeout_threshold' => { value => $heartbeat_timeout_threshold },
'oslo_messaging_rabbit/kombu_compression' => { value => $kombu_compression },
'oslo_messaging_rabbit/kombu_failover_strategy' => { value => $kombu_failover_strategy },

View File

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

View File

@ -23,6 +23,7 @@ describe 'oslo::messaging::rabbit' do
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_transient_queues_ttl').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('<SERVICE DEFAULT>')
end
end
@ -31,6 +32,7 @@ describe 'oslo::messaging::rabbit' do
{ :rabbit_qos_prefetch_count => '10',
:heartbeat_timeout_threshold => '60',
:heartbeat_rate => '10',
:heartbeat_in_pthread => true,
:kombu_compression => 'bz2',
:rabbit_ha_queues => true, }
end
@ -39,6 +41,7 @@ describe 'oslo::messaging::rabbit' do
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_qos_prefetch_count').with_value('10')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value(true)
is_expected.to contain_keystone_config('oslo_messaging_rabbit/kombu_compression').with_value('bz2')
is_expected.to contain_keystone_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true)
end