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: Ibf83bd5182175cced50791526bc69d7f99f0e81a
This commit is contained in:
Dmitriy Rabotyagov 2023-10-20 13:05:03 +02:00 committed by Dmitriy Rabotyagov
parent 0c897f903f
commit 1053e24b36
3 changed files with 27 additions and 3 deletions

View File

@ -82,7 +82,13 @@ senlin_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}"
senlin_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}"
senlin_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}"
senlin_oslomsg_rpc_userid: senlin
senlin_oslomsg_rpc_vhost: /senlin
# vhost name depends on value of oslomsg_rabbit_quorum_queues. In case quorum queues
# are not used - vhost name will be prefixed with leading `/`.
senlin_oslomsg_rpc_vhost:
- name: /senlin
state: "{{ senlin_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}"
- name: senlin
state: "{{ senlin_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}"
senlin_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}"
senlin_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}"
@ -99,6 +105,11 @@ senlin_oslomsg_notify_vhost: "{{ senlin_oslomsg_rpc_vhost }}"
senlin_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}"
senlin_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}"
## RabbitMQ integration
senlin_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}"
senlin_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}"
senlin_oslomsg_rabbit_quorum_max_memory_bytes: "{{ oslomsg_rabbit_quorum_max_memory_bytes | default(0) }}"
## (Qdrouterd) integration
# TODO(ansmith): Change structure when more backends will be supported
senlin_oslomsg_amqp1_enabled: "{{ senlin_oslomsg_rpc_transport == 'amqp' }}"

View File

@ -11,7 +11,7 @@ use_journal = True
server_keystone_endpoint_type = public
## RPC Backend
transport_url = {{ senlin_oslomsg_rpc_transport }}://{% for host in senlin_oslomsg_rpc_servers.split(',') %}{{ senlin_oslomsg_rpc_userid }}:{{ senlin_oslomsg_rpc_password }}@{{ host }}:{{ senlin_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ senlin_oslomsg_rpc_vhost }}{% if senlin_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ senlin_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ senlin_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ senlin_oslomsg_rpc_transport }}://{% for host in senlin_oslomsg_rpc_servers.split(',') %}{{ senlin_oslomsg_rpc_userid }}:{{ senlin_oslomsg_rpc_password }}@{{ host }}:{{ senlin_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _senlin_oslomsg_rpc_vhost_conf }}{% if senlin_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ senlin_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ senlin_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
# Default region name used to get services endpoints.
region_name_for_services = {{ senlin_service_region }}
@ -49,6 +49,9 @@ workers = {{ senlin_api_workers | default(senlin_api_threads) }}
[oslo_messaging_rabbit]
ssl = {{ senlin_oslomsg_rpc_use_ssl }}
rabbit_quorum_queue = {{ senlin_oslomsg_rabbit_quorum_queues }}
rabbit_quorum_delivery_limit = {{ senlin_oslomsg_rabbit_quorum_delivery_limit }}
rabbit_quorum_max_memory_bytes = {{ senlin_oslomsg_rabbit_quorum_max_memory_bytes }}
{% if senlin_service_publicuri_proto != senlin_service_internaluri_proto %}
[oslo_middleware]
@ -58,7 +61,7 @@ enable_proxy_headers_parsing = True
# Ceilometer options
[oslo_messaging_notifications]
driver = {{ (senlin_ceilometer_enabled | bool) | ternary('messagingv2', 'noop') }}
transport_url = {{ senlin_oslomsg_notify_transport }}://{% for host in senlin_oslomsg_notify_servers.split(',') %}{{ senlin_oslomsg_notify_userid }}:{{ senlin_oslomsg_notify_password }}@{{ host }}:{{ senlin_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ senlin_oslomsg_notify_vhost }}{% if senlin_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ senlin_oslomsg_notify_ssl_version }}&ssl_ca_file={{ senlin_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ senlin_oslomsg_notify_transport }}://{% for host in senlin_oslomsg_notify_servers.split(',') %}{{ senlin_oslomsg_notify_userid }}:{{ senlin_oslomsg_notify_password }}@{{ host }}:{{ senlin_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _senlin_oslomsg_notify_vhost_conf }}{% if senlin_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ senlin_oslomsg_notify_ssl_version }}&ssl_ca_file={{ senlin_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
[profiler]

View File

@ -18,6 +18,16 @@ _senlin_is_first_play_host: >-
(senlin_services['senlin-api']['group'] in group_names and
inventory_hostname == (groups[senlin_services['senlin-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
_senlin_oslomsg_rpc_vhost_conf: >-
{{
(senlin_oslomsg_rpc_vhost is string) | ternary(
senlin_oslomsg_rpc_vhost, senlin_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
_senlin_oslomsg_notify_vhost_conf: >-
{{
(senlin_oslomsg_notify_vhost is string) | ternary(
senlin_oslomsg_notify_vhost, senlin_oslomsg_notify_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
#
# Compile a list of the services on a host based on whether