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: I7e4e8b3be33536545b5b4bcfb4855e8c160bb152
This commit is contained in:
Dmitriy Rabotyagov 2023-10-20 10:58:40 +02:00 committed by Dmitriy Rabotyagov
parent c1cf354dc4
commit a78b40a491
3 changed files with 28 additions and 3 deletions

View File

@ -85,7 +85,12 @@ heat_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}"
heat_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}"
heat_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}"
heat_oslomsg_rpc_userid: heat
heat_oslomsg_rpc_vhost: /heat
heat_oslomsg_rpc_vhost:
- name: /heat
state: "{{ heat_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}"
- name: heat
state: "{{ heat_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}"
heat_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}"
heat_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}"
@ -102,6 +107,11 @@ heat_oslomsg_notify_vhost: "{{ heat_oslomsg_rpc_vhost }}"
heat_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}"
heat_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}"
## RabbitMQ integration
heat_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}"
heat_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}"
heat_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
heat_oslomsg_amqp1_enabled: "{{ heat_oslomsg_rpc_transport == 'amqp' }}"

View File

@ -24,7 +24,7 @@ auth_encryption_key = {{ heat_auth_encryption_key }}
num_engine_workers = {{ heat_engine_workers | default(heat_api_threads) }}
## RPC Backend
transport_url = {{ heat_oslomsg_rpc_transport }}://{% for host in heat_oslomsg_rpc_servers.split(',') %}{{ heat_oslomsg_rpc_userid }}:{{ heat_oslomsg_rpc_password }}@{{ host }}:{{ heat_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ heat_oslomsg_rpc_vhost }}{% if heat_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ heat_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ heat_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ heat_oslomsg_rpc_transport }}://{% for host in heat_oslomsg_rpc_servers.split(',') %}{{ heat_oslomsg_rpc_userid }}:{{ heat_oslomsg_rpc_password }}@{{ host }}:{{ heat_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _heat_oslomsg_rpc_vhost_conf }}{% if heat_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ heat_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ heat_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
## Plugin dirs
plugin_dirs = {{ heat_plugin_dirs | join(',') }}
@ -65,6 +65,9 @@ bind_port = {{ heat_cfn_service_port }}
[oslo_messaging_rabbit]
ssl = {{ heat_oslomsg_rpc_use_ssl }}
rabbit_quorum_queue = {{ heat_oslomsg_rabbit_quorum_queues }}
rabbit_quorum_delivery_limit = {{ heat_oslomsg_rabbit_quorum_delivery_limit }}
rabbit_quorum_max_memory_bytes = {{ heat_oslomsg_rabbit_quorum_max_memory_bytes }}
{% if heat_service_publicuri_proto != heat_service_internaluri_proto %}
[oslo_middleware]
@ -74,7 +77,7 @@ enable_proxy_headers_parsing = True
# Ceilometer options
[oslo_messaging_notifications]
driver = {{ (heat_ceilometer_enabled | bool) | ternary('messagingv2', 'noop') }}
transport_url = {{ heat_oslomsg_notify_transport }}://{% for host in heat_oslomsg_notify_servers.split(',') %}{{ heat_oslomsg_notify_userid }}:{{ heat_oslomsg_notify_password }}@{{ host }}:{{ heat_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ heat_oslomsg_notify_vhost }}{% if heat_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ heat_oslomsg_notify_ssl_version }}&ssl_ca_file={{ heat_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
transport_url = {{ heat_oslomsg_notify_transport }}://{% for host in heat_oslomsg_notify_servers.split(',') %}{{ heat_oslomsg_notify_userid }}:{{ heat_oslomsg_notify_password }}@{{ host }}:{{ heat_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _heat_oslomsg_notify_vhost_conf }}{% if heat_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ heat_oslomsg_notify_ssl_version }}&ssl_ca_file={{ heat_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %}
[profiler]

View File

@ -19,6 +19,18 @@ _heat_is_first_play_host: >-
groups[heat_services['heat-api']['group']] | intersect(ansible_play_hosts)) | first) | bool
}}
_heat_oslomsg_rpc_vhost_conf: >-
{{
(heat_oslomsg_rpc_vhost is string) | ternary(
heat_oslomsg_rpc_vhost, heat_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
_heat_oslomsg_notify_vhost_conf: >-
{{
(heat_oslomsg_notify_vhost is string) | ternary(
heat_oslomsg_notify_vhost, heat_oslomsg_notify_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first)
}}
#
# Compile a list of the services on a host based on whether
# the host is in the host group and the service is enabled.