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.

Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-plugins/+/896017
Change-Id: I947be8d94b3263ed69311667af693a481765b1c4
This commit is contained in:
Dmitriy Rabotyagov 2023-10-20 13:45:23 +02:00 committed by Dmitriy Rabotyagov
parent 810e58bd11
commit 3f7085e58a
3 changed files with 28 additions and 3 deletions

View File

@ -72,7 +72,13 @@ sahara_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}"
sahara_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}"
sahara_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}"
sahara_oslomsg_rpc_userid: sahara
sahara_oslomsg_rpc_vhost: /sahara
# vhost name depends on value of oslomsg_rabbit_quorum_queues. In case quorum queues
# are not used - vhost name will be prefixed with leading `/`.
sahara_oslomsg_rpc_vhost:
- name: /sahara
state: "{{ sahara_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}"
- name: sahara
state: "{{ sahara_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}"
sahara_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}"
sahara_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}"
@ -89,6 +95,11 @@ sahara_oslomsg_notify_vhost: "{{ sahara_oslomsg_rpc_vhost }}"
sahara_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}"
sahara_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}"
## RabbitMQ integration
sahara_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}"
sahara_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}"
sahara_oslomsg_rabbit_quorum_max_memory_bytes: "{{ oslomsg_rabbit_quorum_max_memory_bytes | default(0) }}"
## (Qdrouterd) info
# TODO(ansmith): Change structure when more backends will be supported
sahara_oslomsg_amqp1_enabled: "{{ sahara_oslomsg_rpc_transport == 'amqp' }}"

View File

@ -24,7 +24,7 @@ proxy_user_role_names = {{ sahara_proxy_user_role_names }}
{% endif %}
## RPC Backend
transport_url = {{ sahara_oslomsg_rpc_transport }}://{% for host in sahara_oslomsg_rpc_servers.split(',') %}{{ sahara_oslomsg_rpc_userid }}:{{ sahara_oslomsg_rpc_password }}@{{ host }}:{{ sahara_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ sahara_oslomsg_rpc_vhost }}{% if sahara_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ sahara_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ sahara_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ sahara_oslomsg_rpc_transport }}://{% for host in sahara_oslomsg_rpc_servers.split(',') %}{{ sahara_oslomsg_rpc_userid }}:{{ sahara_oslomsg_rpc_password }}@{{ host }}:{{ sahara_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _sahara_oslomsg_rpc_vhost_conf }}{% if sahara_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ sahara_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ sahara_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
[database]
connection = mysql+pymysql://{{ sahara_galera_user }}:{{ sahara_container_mysql_password }}@{{ sahara_galera_address }}:{{ sahara_galera_port }}/{{ sahara_galera_database }}?charset=utf8{% if sahara_galera_use_ssl | bool %}&ssl_verify_cert=true{% if sahara_galera_ssl_ca_cert | length > 0 %}&ssl_ca={{ sahara_galera_ssl_ca_cert }}{% endif %}{% endif +%}
@ -64,10 +64,13 @@ policy_dirs = {{ sahara_policy_dirs }}
# Ceilometer options
[oslo_messaging_notifications]
driver = {{ (sahara_ceilometer_enabled | bool) | ternary('messagingv2', 'noop') }}
transport_url = {{ sahara_oslomsg_notify_transport }}://{% for host in sahara_oslomsg_notify_servers.split(',') %}{{ sahara_oslomsg_notify_userid }}:{{ sahara_oslomsg_notify_password }}@{{ host }}:{{ sahara_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ sahara_oslomsg_notify_vhost }}{% if sahara_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ sahara_oslomsg_notify_ssl_version }}&ssl_ca_file={{ sahara_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ sahara_oslomsg_notify_transport }}://{% for host in sahara_oslomsg_notify_servers.split(',') %}{{ sahara_oslomsg_notify_userid }}:{{ sahara_oslomsg_notify_password }}@{{ host }}:{{ sahara_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _sahara_oslomsg_notify_vhost_conf }}{% if sahara_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ sahara_oslomsg_notify_ssl_version }}&ssl_ca_file={{ sahara_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
[oslo_messaging_rabbit]
ssl = {{ sahara_oslomsg_rpc_use_ssl }}
rabbit_quorum_queue = {{ sahara_oslomsg_rabbit_quorum_queues }}
rabbit_quorum_delivery_limit = {{ sahara_oslomsg_rabbit_quorum_delivery_limit }}
rabbit_quorum_max_memory_bytes = {{ sahara_oslomsg_rabbit_quorum_max_memory_bytes }}
[profiler]
enabled = {{ sahara_profiler_enabled }}

View File

@ -18,6 +18,17 @@ _sahara_is_first_play_host: >-
(sahara_services['sahara-api']['group'] in group_names and
inventory_hostname == (groups[sahara_services['sahara-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
_sahara_oslomsg_rpc_vhost_conf: >-
{{
(sahara_oslomsg_rpc_vhost is string) | ternary(
sahara_oslomsg_rpc_vhost, sahara_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
_sahara_oslomsg_notify_vhost_conf: >-
{{
(sahara_oslomsg_notify_vhost is string) | ternary(
sahara_oslomsg_notify_vhost, sahara_oslomsg_notify_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
filtered_sahara_services: |-
{% set services = [] %}