From 521337906e9e4677340ebf9756bc3f2c76a65180 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: I3e4d9da942b352d446613c7241539f564b753d64 Closes-Bug: #1840868 --- manifests/init.pp | 52 ++++++++++++------- ...artbeat-over-pthread-be3acd21c9c35f95.yaml | 6 +++ spec/classes/designate_init_spec.rb | 7 ++- 3 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 releasenotes/notes/rabbitmq-heartbeat-over-pthread-be3acd21c9c35f95.yaml diff --git a/manifests/init.pp b/manifests/init.pp index 75a17f80..591cedf9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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, } diff --git a/releasenotes/notes/rabbitmq-heartbeat-over-pthread-be3acd21c9c35f95.yaml b/releasenotes/notes/rabbitmq-heartbeat-over-pthread-be3acd21c9c35f95.yaml new file mode 100644 index 00000000..496d2279 --- /dev/null +++ b/releasenotes/notes/rabbitmq-heartbeat-over-pthread-be3acd21c9c35f95.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/designate_init_spec.rb b/spec/classes/designate_init_spec.rb index 684bef39..307f5da6 100644 --- a/spec/classes/designate_init_spec.rb +++ b/spec/classes/designate_init_spec.rb @@ -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('') + is_expected.to contain_designate_config('oslo_messaging_rabbit/heartbeat_in_pthread').with_value('') is_expected.to contain_designate_config('DEFAULT/transport_url').with_value('') is_expected.to contain_designate_config('DEFAULT/rpc_response_timeout').with_value('') is_expected.to contain_designate_config('DEFAULT/control_exchange').with_value('') @@ -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('') } end