Add quorum queues support for service

This change implements and enables by default quorum support
for rabbitmq as well as providing default variables to globally tune
it's behaviour.

In order to ensure upgrade path and ability to switch back to HA queues
we change vhost names with removing leading `/`, as enabling quorum
requires to remove exchange which is tricky thing to do with running
services.

Change-Id: I900f40d7db6c26356252a7be736c1b3bdc98cace
This commit is contained in:
Dmitriy Rabotyagov 2023-10-20 11:26:26 +02:00 committed by Dmitriy Rabotyagov
parent a39be0602c
commit 8ac4957d11
3 changed files with 24 additions and 2 deletions

View File

@ -105,7 +105,13 @@ mistral_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}"
mistral_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}"
mistral_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}"
mistral_oslomsg_rpc_userid: mistral
mistral_oslomsg_rpc_vhost: /mistral
# vhost name depends on value of oslomsg_rabbit_quorum_queues. In case quorum queues
# are not used - vhost name will be prefixed with leading `/`.
mistral_oslomsg_rpc_vhost:
- name: /mistral
state: "{{ mistral_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}"
- name: mistral
state: "{{ mistral_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}"
mistral_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}"
mistral_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}"
@ -122,6 +128,11 @@ mistral_oslomsg_notify_vhost: "{{ mistral_oslomsg_rpc_vhost }}"
mistral_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}"
mistral_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}"
## RabbitMQ integration
mistral_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}"
mistral_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}"
mistral_oslomsg_rabbit_quorum_max_memory_bytes: "{{ oslomsg_rabbit_quorum_max_memory_bytes | default(0) }}"
# (Qdrouterd) integration
mistral_oslomsg_amqp1_enabled: "{{ mistral_oslomsg_rpc_transport == 'amqp' }}"

View File

@ -3,7 +3,7 @@
[DEFAULT]
debug = {{ mistral_debug }}
use_journal = True
transport_url = {{ mistral_oslomsg_rpc_transport }}://{% for host in mistral_oslomsg_rpc_servers.split(',') %}{{ mistral_oslomsg_rpc_userid }}:{{ mistral_oslomsg_rpc_password }}@{{ host }}:{{ mistral_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ mistral_oslomsg_rpc_vhost }}{% if mistral_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ mistral_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ mistral_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ mistral_oslomsg_rpc_transport }}://{% for host in mistral_oslomsg_rpc_servers.split(',') %}{{ mistral_oslomsg_rpc_userid }}:{{ mistral_oslomsg_rpc_password }}@{{ host }}:{{ mistral_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _mistral_oslomsg_rpc_vhost_conf }}{% if mistral_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ mistral_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ mistral_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
[api]
host = {{ mistral_bind_address }}
@ -38,3 +38,9 @@ service_type = {{ mistral_service_type }}
memcached_servers = {{ mistral_memcached_servers }}
memcache_security_strategy = ENCRYPT
memcache_secret_key = {{ memcached_encryption_key }}
[oslo_messaging_rabbit]
ssl = {{ mistral_oslomsg_notify_use_ssl | bool }}
rabbit_quorum_queue = {{ mistral_oslomsg_rabbit_quorum_queues }}
rabbit_quorum_delivery_limit = {{ mistral_oslomsg_rabbit_quorum_delivery_limit }}
rabbit_quorum_max_memory_bytes = {{ mistral_oslomsg_rabbit_quorum_max_memory_bytes }}

View File

@ -18,6 +18,11 @@ _mistral_is_first_play_host: >-
(mistral_services['mistral-api']['group'] in group_names and
inventory_hostname == (groups[mistral_services['mistral-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
_mistral_oslomsg_rpc_vhost_conf: >-
{{
(mistral_oslomsg_rpc_vhost is string) | ternary(
mistral_oslomsg_rpc_vhost, mistral_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
#
# Compile a list of the services on a host based on whether