From f4dfaf26faa49e5b5e48a617def10d79fdc356ee Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Mon, 17 Mar 2025 17:14:55 +0100 Subject: [PATCH] Add a rabbit_transient_queues_ttl and amqp_auto_delete params Since transient_queues_ttl is also managed by oslo::messaging::rabbit, there's no way to use nova_config to set it, so this patch is mandatory for one to set rabbit_transient_queues_ttl in nova.conf. Change-Id: I6aa11906d47c0251e0792637cb940f9f2a8fe425 --- manifests/init.pp | 16 ++++++++++++++++ .../notes/amqp_auto_delete-c452bf98830afe1a.yaml | 5 +++++ ...it_transient_queues_ttl-f1b43dda25844321.yaml | 6 ++++++ spec/classes/nova_init_spec.rb | 6 ++++++ 4 files changed, 33 insertions(+) create mode 100644 releasenotes/notes/amqp_auto_delete-c452bf98830afe1a.yaml create mode 100644 releasenotes/notes/rabbit_transient_queues_ttl-f1b43dda25844321.yaml diff --git a/manifests/init.pp b/manifests/init.pp index d6d52191f..3969dc2fd 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -69,6 +69,14 @@ # (Optional) Use quorum queues for transients queues in RabbitMQ. # Defaults to $facts['os_service_default'] # +# [*rabbit_transient_queues_ttl*] +# (Optional) Positive integer representing duration in seconds for +# queue TTL (x-expires). Queues which are unused for the duration +# of the TTL are automatically deleted. +# The parameter affects only reply and fanout queues. (integer value) +# Min to 1 +# Defaults to $facts['os_service_default'] +# # [*rabbit_quorum_delivery_limit*] # (Optional) Each time a message is rdelivered to a consumer, a counter is # incremented. Once the redelivery count exceeds the delivery limit @@ -129,6 +137,10 @@ # (string value) # Defaults to $facts['os_service_default'] # +# [*amqp_auto_delete*] +# (Optional) Define if transient queues should be auto-deleted (boolean value) +# Defaults to $facts['os_service_default'] +# # [*amqp_durable_queues*] # (optional) Define queues as "durable" to rabbitmq. (boolean value) # Defaults to $facts['os_service_default'] @@ -355,6 +367,7 @@ class nova( $rabbit_qos_prefetch_count = $facts['os_service_default'], $rabbit_ha_queues = $facts['os_service_default'], $rabbit_quorum_queue = $facts['os_service_default'], + $rabbit_transient_queues_ttl = $facts['os_service_default'], $rabbit_transient_quorum_queue = $facts['os_service_default'], $rabbit_quorum_delivery_limit = $facts['os_service_default'], $rabbit_quorum_max_memory_length = $facts['os_service_default'], @@ -369,6 +382,7 @@ class nova( $kombu_failover_strategy = $facts['os_service_default'], $kombu_compression = $facts['os_service_default'], $amqp_durable_queues = $facts['os_service_default'], + $amqp_auto_delete = $facts['os_service_default'], $host = $facts['os_service_default'], $service_down_time = $facts['os_service_default'], $state_path = '/var/lib/nova', @@ -518,6 +532,7 @@ class nova( kombu_reconnect_delay => $kombu_reconnect_delay, kombu_failover_strategy => $kombu_failover_strategy, amqp_durable_queues => $amqp_durable_queues, + amqp_auto_delete => $amqp_auto_delete, kombu_compression => $kombu_compression, kombu_ssl_ca_certs => $kombu_ssl_ca_certs, kombu_ssl_certfile => $kombu_ssl_certfile, @@ -526,6 +541,7 @@ class nova( rabbit_ha_queues => $rabbit_ha_queues, rabbit_quorum_queue => $rabbit_quorum_queue, rabbit_transient_quorum_queue => $rabbit_transient_quorum_queue, + rabbit_transient_queues_ttl => $rabbit_transient_queues_ttl, rabbit_quorum_delivery_limit => $rabbit_quorum_delivery_limit, rabbit_quorum_max_memory_length => $rabbit_quorum_max_memory_length, rabbit_quorum_max_memory_bytes => $rabbit_quorum_max_memory_bytes, diff --git a/releasenotes/notes/amqp_auto_delete-c452bf98830afe1a.yaml b/releasenotes/notes/amqp_auto_delete-c452bf98830afe1a.yaml new file mode 100644 index 000000000..bb24709f3 --- /dev/null +++ b/releasenotes/notes/amqp_auto_delete-c452bf98830afe1a.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Add a new ``amqp_auto_delete`` parameter, so that transient queues are + automatically deleted. diff --git a/releasenotes/notes/rabbit_transient_queues_ttl-f1b43dda25844321.yaml b/releasenotes/notes/rabbit_transient_queues_ttl-f1b43dda25844321.yaml new file mode 100644 index 000000000..c9f81684f --- /dev/null +++ b/releasenotes/notes/rabbit_transient_queues_ttl-f1b43dda25844321.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + A new parameter ``rabbit_transient_queues_ttl`` has been added to the + nova class to configure how long transtient queue should stay until + they are automatically deleted. diff --git a/spec/classes/nova_init_spec.rb b/spec/classes/nova_init_spec.rb index 489fde53c..fd391f8ca 100644 --- a/spec/classes/nova_init_spec.rb +++ b/spec/classes/nova_init_spec.rb @@ -45,6 +45,7 @@ describe 'nova' do :kombu_reconnect_delay => '', :kombu_failover_strategy => '', :amqp_durable_queues => '', + :amqp_auto_delete => '', :kombu_compression => '', :kombu_ssl_ca_certs => '', :kombu_ssl_certfile => '', @@ -53,6 +54,7 @@ describe 'nova' do :rabbit_ha_queues => '', :rabbit_quorum_queue => '', :rabbit_transient_quorum_queue => '', + :rabbit_transient_queues_ttl => '', :rabbit_quorum_delivery_limit => '', :rabbit_quorum_max_memory_length => '', :rabbit_quorum_max_memory_bytes => '', @@ -115,6 +117,7 @@ describe 'nova' do :rabbit_qos_prefetch_count => 0, :kombu_reconnect_delay => '5.0', :amqp_durable_queues => true, + :amqp_auto_delete => true, :kombu_compression => 'gzip', :kombu_ssl_ca_certs => '/etc/ca.cert', :kombu_ssl_certfile => '/etc/certfile', @@ -123,6 +126,7 @@ describe 'nova' do :rabbit_ha_queues => true, :rabbit_quorum_queue => true, :rabbit_transient_quorum_queue => true, + :rabbit_transient_queues_ttl => 60, :rabbit_quorum_delivery_limit => 3, :rabbit_quorum_max_memory_length => 5, :rabbit_quorum_max_memory_bytes => 1073741824, @@ -192,6 +196,7 @@ describe 'nova' do :rabbit_qos_prefetch_count => 0, :kombu_reconnect_delay => '5.0', :amqp_durable_queues => true, + :amqp_auto_delete => true, :kombu_compression => 'gzip', :kombu_ssl_ca_certs => '/etc/ca.cert', :kombu_ssl_certfile => '/etc/certfile', @@ -200,6 +205,7 @@ describe 'nova' do :rabbit_ha_queues => true, :rabbit_quorum_queue => true, :rabbit_transient_quorum_queue => true, + :rabbit_transient_queues_ttl => 60, :rabbit_quorum_delivery_limit => 3, :rabbit_quorum_max_memory_length => 5, :rabbit_quorum_max_memory_bytes => 1073741824,