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: I7d60a7e7caada6554facc9eeec27815ea44a4cf4
Closes-Bug: #1840868
This commit is contained in:
ZhongShengping 2019-08-21 14:21:01 +08:00
parent ff10094f15
commit 27c7219a41
3 changed files with 26 additions and 5 deletions

View File

@ -116,6 +116,16 @@
# (Optional) Backoff between reconnection attempts for rabbit.
# 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_version*]
# (optional) SSL version to use (valid only if SSL enabled).
# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
@ -277,6 +287,7 @@ class sahara(
$rabbit_login_method = $::os_service_default,
$rabbit_retry_interval = $::os_service_default,
$rabbit_retry_backoff = $::os_service_default,
$rabbit_heartbeat_in_pthread = $::os_service_default,
$kombu_ssl_version = $::os_service_default,
$kombu_ssl_keyfile = $::os_service_default,
$kombu_ssl_certfile = $::os_service_default,
@ -354,6 +365,7 @@ class sahara(
rabbit_login_method => $rabbit_login_method,
rabbit_retry_interval => $rabbit_retry_interval,
rabbit_retry_backoff => $rabbit_retry_backoff,
heartbeat_in_pthread => $rabbit_heartbeat_in_pthread,
}
oslo::messaging::amqp { 'sahara_config':

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

@ -35,6 +35,7 @@ describe 'sahara' do
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_compression').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('DEFAULT/control_exchange').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>') }
@ -73,16 +74,18 @@ describe 'sahara' do
context 'when passing params' do
before do
params.merge!({
:rabbit_ha_queues => 'true',
:amqp_durable_queues => 'true',
:kombu_reconnect_delay => '1.0',
:kombu_compression => 'gzip',
:kombu_failover_strategy => 'round-robin',
:rabbit_ha_queues => 'true',
:amqp_durable_queues => 'true',
:rabbit_heartbeat_in_pthread => 'true',
:kombu_reconnect_delay => '1.0',
:kombu_compression => 'gzip',
:kombu_failover_strategy => 'round-robin',
})
end
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('true') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('1.0') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_compression').with_value('gzip') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('round-robin') }