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: Ib19e867066f5a799fdf201495594352c03104612
Closes-Bug: #1840868
This commit is contained in:
ZhongShengping 2019-08-21 14:21:01 +08:00
parent 7011e7daa3
commit 31aa947c09
3 changed files with 25 additions and 1 deletions

View File

@ -82,6 +82,16 @@
# every 30 seconds. # every 30 seconds.
# Defaults to $::os_service_default # 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_use_ssl*] # [*rabbit_use_ssl*]
# (optional) Connect over SSL for RabbitMQ # (optional) Connect over SSL for RabbitMQ
# Defaults to $::os_service_default # Defaults to $::os_service_default
@ -192,6 +202,7 @@ class mistral(
$rabbit_ha_queues = $::os_service_default, $rabbit_ha_queues = $::os_service_default,
$rabbit_heartbeat_timeout_threshold = $::os_service_default, $rabbit_heartbeat_timeout_threshold = $::os_service_default,
$rabbit_heartbeat_rate = $::os_service_default, $rabbit_heartbeat_rate = $::os_service_default,
$rabbit_heartbeat_in_pthread = $::os_service_default,
$rabbit_use_ssl = $::os_service_default, $rabbit_use_ssl = $::os_service_default,
$service_down_time = $::os_service_default, $service_down_time = $::os_service_default,
$report_interval = $::os_service_default, $report_interval = $::os_service_default,
@ -259,6 +270,7 @@ class mistral(
kombu_reconnect_delay => $kombu_reconnect_delay, kombu_reconnect_delay => $kombu_reconnect_delay,
heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold,
heartbeat_rate => $rabbit_heartbeat_rate, heartbeat_rate => $rabbit_heartbeat_rate,
heartbeat_in_pthread => $rabbit_heartbeat_in_pthread,
amqp_durable_queues => $amqp_durable_queues, 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

@ -44,6 +44,7 @@ describe 'mistral' do
should contain_mistral_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => '<SERVICE DEFAULT>') should contain_mistral_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>') should contain_mistral_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
should contain_mistral_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>') should contain_mistral_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
should contain_mistral_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('<SERVICE DEFAULT>')
should contain_mistral_config('oslo_messaging_rabbit/kombu_reconnect_delay').with(:value => '<SERVICE DEFAULT>') should contain_mistral_config('oslo_messaging_rabbit/kombu_reconnect_delay').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('oslo_messaging_rabbit/kombu_failover_strategy').with(:value => '<SERVICE DEFAULT>') should contain_mistral_config('oslo_messaging_rabbit/kombu_failover_strategy').with(:value => '<SERVICE DEFAULT>')
should contain_mistral_config('coordination/backend_url').with(:value => '<SERVICE DEFAULT>') should contain_mistral_config('coordination/backend_url').with(:value => '<SERVICE DEFAULT>')
@ -107,12 +108,17 @@ describe 'mistral' do
context 'with rabbitmq heartbeats' do context 'with rabbitmq heartbeats' do
let :params do let :params do
req_params.merge({'rabbit_heartbeat_timeout_threshold' => '60', 'rabbit_heartbeat_rate' => '10'}) req_params.merge({
'rabbit_heartbeat_timeout_threshold' => '60',
'rabbit_heartbeat_rate' => '10',
'rabbit_heartbeat_in_pthread' => true
})
end end
it 'should contain heartbeat config' do it 'should contain heartbeat config' do
should contain_mistral_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') should contain_mistral_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60')
should contain_mistral_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') should contain_mistral_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10')
should contain_mistral_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value(true)
end end
end end