From 89c24924dc907cee177c0700992253dae67c864d Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Thu, 6 Jul 2023 14:55:24 +0200 Subject: [PATCH] Add quorum queues support for the 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/+/875399 Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/873618 Change-Id: I43840a397ea6da6c3187291a74591c2205e1dca1 --- defaults/main.yml | 10 ++++++++-- templates/neutron.conf.j2 | 7 +++++-- vars/main.yml | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 26a18106..6d103311 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -250,7 +250,11 @@ neutron_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}" neutron_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}" neutron_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}" neutron_oslomsg_rpc_userid: neutron -neutron_oslomsg_rpc_vhost: /neutron +neutron_oslomsg_rpc_vhost: + - name: /neutron + state: "{{ neutron_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}" + - name: neutron + state: "{{ neutron_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}" neutron_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}" neutron_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}" @@ -277,7 +281,9 @@ neutron_oslomsg_amqp1_enabled: "{{ neutron_oslomsg_rpc_transport == 'amqp' }}" ### ### (RabbitMQ) integration ### - +neutron_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}" +neutron_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}" +neutron_oslomsg_rabbit_quorum_max_memory_bytes: "{{ oslomsg_rabbit_quorum_max_memory_bytes | default(0) }}" neutron_rpc_thread_pool_size: 64 neutron_rpc_conn_pool_size: 30 neutron_rpc_response_timeout: 60 diff --git a/templates/neutron.conf.j2 b/templates/neutron.conf.j2 index 1f9bb64d..4a8bbf00 100644 --- a/templates/neutron.conf.j2 +++ b/templates/neutron.conf.j2 @@ -18,7 +18,7 @@ use_journal = True ## Rpc all executor_thread_pool_size = {{ neutron_rpc_thread_pool_size }} rpc_response_timeout = {{ neutron_rpc_response_timeout }} -transport_url = {{ neutron_oslomsg_rpc_transport }}://{% for host in neutron_oslomsg_rpc_servers.split(',') %}{{ neutron_oslomsg_rpc_userid }}:{{ neutron_oslomsg_rpc_password }}@{{ host }}:{{ neutron_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ neutron_oslomsg_rpc_vhost }}{% if neutron_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ neutron_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ neutron_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +transport_url = {{ neutron_oslomsg_rpc_transport }}://{% for host in neutron_oslomsg_rpc_servers.split(',') %}{{ neutron_oslomsg_rpc_userid }}:{{ neutron_oslomsg_rpc_password }}@{{ host }}:{{ neutron_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _neutron_oslomsg_rpc_vhost_conf }}{% if neutron_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ neutron_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ neutron_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} # Domain to use for building hostnames dns_domain = {{ neutron_dns_domain }} @@ -238,6 +238,9 @@ root_helper_daemon = sudo {{ neutron_bin }}/neutron-rootwrap-daemon {{ neutron_c [oslo_messaging_rabbit] rpc_conn_pool_size = {{ neutron_rpc_conn_pool_size }} heartbeat_in_pthread = {{ neutron_oslomsg_heartbeat_in_pthread }} +rabbit_quorum_queue = {{ neutron_oslomsg_rabbit_quorum_queues }} +rabbit_quorum_delivery_limit = {{ neutron_oslomsg_rabbit_quorum_delivery_limit }} +rabbit_quorum_max_memory_bytes = {{ neutron_oslomsg_rabbit_quorum_max_memory_bytes }} # Notifications [oslo_messaging_notifications] @@ -247,7 +250,7 @@ heartbeat_in_pthread = {{ neutron_oslomsg_heartbeat_in_pthread }} {% endif %} topics = {{ notification_topics | join(',') }} driver = {{ (notification_topics | length > 0) | ternary('messagingv2', 'noop') }} -transport_url = {{ neutron_oslomsg_notify_transport }}://{% for host in neutron_oslomsg_notify_servers.split(',') %}{{ neutron_oslomsg_notify_userid }}:{{ neutron_oslomsg_notify_password }}@{{ host }}:{{ neutron_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ neutron_oslomsg_notify_vhost }}{% if neutron_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ neutron_oslomsg_notify_ssl_version }}&ssl_ca_file={{ neutron_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +transport_url = {{ neutron_oslomsg_notify_transport }}://{% for host in neutron_oslomsg_notify_servers.split(',') %}{{ neutron_oslomsg_notify_userid }}:{{ neutron_oslomsg_notify_password }}@{{ host }}:{{ neutron_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _neutron_oslomsg_notify_vhost_conf }}{% if neutron_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ neutron_oslomsg_notify_ssl_version }}&ssl_ca_file={{ neutron_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} # Concurrency (locking mechanisms) [oslo_concurrency] diff --git a/vars/main.yml b/vars/main.yml index 5224cba2..cecd5407 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -14,6 +14,8 @@ # limitations under the License. _neutron_is_first_play_host: "{{ (neutron_services['neutron-server']['group'] in group_names and inventory_hostname == (groups[neutron_services['neutron-server']['group']] | intersect(ansible_play_hosts)) | first) | bool }}" +_neutron_oslomsg_rpc_vhost_conf: "{{ (neutron_oslomsg_rpc_vhost is string) | ternary(neutron_oslomsg_rpc_vhost, neutron_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first) }}" +_neutron_oslomsg_notify_vhost_conf: "{{ (neutron_oslomsg_notify_vhost is string) | ternary(neutron_oslomsg_notify_vhost, neutron_oslomsg_notify_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first) }}" ### ### Open vSwitch