From 88b37c44fa6bf4df19beb105f6ea0b2ae7eb002f Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Wed, 21 Aug 2019 14:21:01 +0800 Subject: [PATCH] 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: I0e3503342fcf7e211cf80e4af3ba75ac8cc917d4 Closes-Bug: #1840868 --- manifests/init.pp | 12 ++++++++++++ ...itmq-heartbeat-over-pthread-ab7ab8985802707d.yaml | 6 ++++++ spec/classes/neutron_init_spec.rb | 8 +++++++- 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/rabbitmq-heartbeat-over-pthread-ab7ab8985802707d.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 67088366e..f47be1cd6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -135,6 +135,16 @@ # every 30 seconds. # 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*] # (optional) Connect over SSL for RabbitMQ # Defaults to $::os_service_default @@ -345,6 +355,7 @@ class neutron ( $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_use_ssl = $::os_service_default, $rabbit_transient_queues_ttl = $::os_service_default, $amqp_durable_queues = $::os_service_default, @@ -477,6 +488,7 @@ class neutron ( oslo::messaging::rabbit {'neutron_config': heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, heartbeat_rate => $rabbit_heartbeat_rate, + heartbeat_in_pthread => $rabbit_heartbeat_in_pthread, rabbit_use_ssl => $rabbit_use_ssl, rabbit_transient_queues_ttl => $rabbit_transient_queues_ttl, kombu_reconnect_delay => $kombu_reconnect_delay, diff --git a/releasenotes/notes/rabbitmq-heartbeat-over-pthread-ab7ab8985802707d.yaml b/releasenotes/notes/rabbitmq-heartbeat-over-pthread-ab7ab8985802707d.yaml new file mode 100644 index 000000000..496d2279e --- /dev/null +++ b/releasenotes/notes/rabbitmq-heartbeat-over-pthread-ab7ab8985802707d.yaml @@ -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. diff --git a/spec/classes/neutron_init_spec.rb b/spec/classes/neutron_init_spec.rb index 331954c7e..3bed0635a 100644 --- a/spec/classes/neutron_init_spec.rb +++ b/spec/classes/neutron_init_spec.rb @@ -14,7 +14,11 @@ describe 'neutron' do it_behaves_like 'a neutron base installation' context 'with rabbitmq heartbeat configured' do - before { params.merge!( :rabbit_heartbeat_timeout_threshold => '60', :rabbit_heartbeat_rate => '10' ) } + before { params.merge!( + :rabbit_heartbeat_timeout_threshold => '60', + :rabbit_heartbeat_rate => '10', + :rabbit_heartbeat_in_pthread => true, + ) } it_behaves_like 'rabbit with heartbeat configured' end @@ -76,6 +80,7 @@ describe 'neutron' do it 'configures rabbit' do should contain_neutron_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('') should contain_neutron_config('oslo_messaging_rabbit/heartbeat_rate').with_value('') + should contain_neutron_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('') should contain_neutron_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value( '' ) should contain_neutron_config('oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout').with_value( '' ) should contain_neutron_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value( '' ) @@ -113,6 +118,7 @@ describe 'neutron' do it 'in neutron.conf' do should contain_neutron_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60') should contain_neutron_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10') + should contain_neutron_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value(true) end end