From 88168754f49fe29ac5177e0153379bb328c2144e Mon Sep 17 00:00:00 2001 From: Thomas Goirand Date: Tue, 18 Mar 2025 11:47:41 +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 ironic_config to set it, so this patch is mandatory for one to set rabbit_transient_queues_ttl in ironic.conf. Same applies to ironic_inspector_config. Change-Id: I95625460e2b79cd071819edc6b397cae907c9bf4 --- manifests/init.pp | 16 ++++++++++++++++ manifests/inspector.pp | 16 ++++++++++++++++ .../notes/amqp_auto_delete-b98bdd56078b7731.yaml | 6 ++++++ ...it_transient_queues_ttl-dc4ca94eba053e82.yaml | 6 ++++++ spec/classes/ironic_init_spec.rb | 6 ++++++ spec/classes/ironic_inspector_spec.rb | 6 ++++++ 6 files changed, 56 insertions(+) create mode 100644 releasenotes/notes/amqp_auto_delete-b98bdd56078b7731.yaml create mode 100644 releasenotes/notes/rabbit_transient_queues_ttl-dc4ca94eba053e82.yaml diff --git a/manifests/init.pp b/manifests/init.pp index f60cf299..f47fb788 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -110,6 +110,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 @@ -169,6 +177,10 @@ # (optional) Define queues as "durable" to rabbitmq. (boolean 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'] +# # [*sync_db*] # Enable dbsync # Defaults to true @@ -252,6 +264,7 @@ class ironic ( $rabbit_ha_queues = $facts['os_service_default'], $rabbit_quorum_queue = $facts['os_service_default'], $rabbit_transient_quorum_queue = $facts['os_service_default'], + $rabbit_transient_queues_ttl = $facts['os_service_default'], $rabbit_quorum_delivery_limit = $facts['os_service_default'], $rabbit_quorum_max_memory_length = $facts['os_service_default'], $rabbit_quorum_max_memory_bytes = $facts['os_service_default'], @@ -264,6 +277,7 @@ class ironic ( $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'], Boolean $sync_db = true, Boolean $db_online_data_migrations = false, Boolean $purge_config = false, @@ -333,6 +347,7 @@ class ironic ( 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, @@ -341,6 +356,7 @@ class ironic ( 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/manifests/inspector.pp b/manifests/inspector.pp index ed196624..b62dbc0b 100644 --- a/manifests/inspector.pp +++ b/manifests/inspector.pp @@ -250,6 +250,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 @@ -309,6 +317,10 @@ # (optional) Define queues as "durable" to rabbitmq. (boolean 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'] +# # [*standalone*] # (optional) Whether to run ironic-inspector as a standalone service. # Defaults to true @@ -373,6 +385,7 @@ class ironic::inspector ( $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'], @@ -386,6 +399,7 @@ class ironic::inspector ( $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'], Boolean $standalone = true, # DEPRECATED PARAMETERS $rabbit_heartbeat_in_pthread = undef, @@ -515,6 +529,7 @@ class ironic::inspector ( 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, @@ -523,6 +538,7 @@ class ironic::inspector ( 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-b98bdd56078b7731.yaml b/releasenotes/notes/amqp_auto_delete-b98bdd56078b7731.yaml new file mode 100644 index 00000000..fb3a7023 --- /dev/null +++ b/releasenotes/notes/amqp_auto_delete-b98bdd56078b7731.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Add a new ``amqp_auto_delete`` parameter, so that transient queues are + automatically deleted. This parameter is available for both the top level + ``ironic`` and the ``ironic::inspector`` classes. diff --git a/releasenotes/notes/rabbit_transient_queues_ttl-dc4ca94eba053e82.yaml b/releasenotes/notes/rabbit_transient_queues_ttl-dc4ca94eba053e82.yaml new file mode 100644 index 00000000..d210d7da --- /dev/null +++ b/releasenotes/notes/rabbit_transient_queues_ttl-dc4ca94eba053e82.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + A new parameter ``rabbit_transient_queues_ttl`` has been added to the + ironic and ironic::inspector classes to configure how long transtient + queue should stay until they are automatically deleted. diff --git a/spec/classes/ironic_init_spec.rb b/spec/classes/ironic_init_spec.rb index 91ae6776..4896bcfa 100644 --- a/spec/classes/ironic_init_spec.rb +++ b/spec/classes/ironic_init_spec.rb @@ -80,6 +80,7 @@ describe 'ironic' do :kombu_reconnect_delay => '', :kombu_failover_strategy => '', :amqp_durable_queues => '', + :amqp_auto_delete => '', :kombu_compression => '', :kombu_ssl_ca_certs => '', :kombu_ssl_certfile => '', @@ -87,6 +88,7 @@ describe 'ironic' do :kombu_ssl_version => '', :rabbit_ha_queues => '', :rabbit_quorum_queue => '', + :rabbit_transient_queues_ttl => '', :rabbit_quorum_delivery_limit => '', :rabbit_quorum_max_memory_length => '', :rabbit_quorum_max_memory_bytes => '', @@ -122,6 +124,7 @@ describe 'ironic' 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', @@ -129,6 +132,7 @@ describe 'ironic' do :kombu_ssl_version => 'TLSv1', :rabbit_ha_queues => true, :rabbit_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, @@ -168,6 +172,7 @@ describe 'ironic' 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', @@ -175,6 +180,7 @@ describe 'ironic' do :kombu_ssl_version => 'TLSv1', :rabbit_ha_queues => true, :rabbit_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, diff --git a/spec/classes/ironic_inspector_spec.rb b/spec/classes/ironic_inspector_spec.rb index f70c536f..fd73621e 100644 --- a/spec/classes/ironic_inspector_spec.rb +++ b/spec/classes/ironic_inspector_spec.rb @@ -140,6 +140,7 @@ describe 'ironic::inspector' do :kombu_reconnect_delay => '', :kombu_failover_strategy => '', :amqp_durable_queues => '', + :amqp_auto_delete => '', :kombu_compression => '', :kombu_ssl_ca_certs => '', :kombu_ssl_certfile => '', @@ -147,6 +148,7 @@ describe 'ironic::inspector' do :kombu_ssl_version => '', :rabbit_ha_queues => '', :rabbit_quorum_queue => '', + :rabbit_transient_queues_ttl => '', :rabbit_quorum_delivery_limit => '', :rabbit_quorum_max_memory_length => '', :rabbit_quorum_max_memory_bytes => '', @@ -255,6 +257,7 @@ describe 'ironic::inspector' 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', @@ -262,6 +265,7 @@ describe 'ironic::inspector' do :kombu_ssl_version => 'TLSv1', :rabbit_ha_queues => true, :rabbit_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, @@ -293,6 +297,7 @@ describe 'ironic::inspector' 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', @@ -300,6 +305,7 @@ describe 'ironic::inspector' do :kombu_ssl_version => 'TLSv1', :rabbit_ha_queues => true, :rabbit_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,