From af229369fba52d9e3a4d9017da5d52f683e0a4e2 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Mon, 27 Feb 2023 12:20:21 +0100 Subject: [PATCH] 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/+/875399 Depends-On: https://review.opendev.org/c/openstack/openstack-ansible/+/873618 Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-os_glance/+/873632 Change-Id: I9e1f87fd2c396eb4b48459c3055b43678fae296a --- defaults/main.yml | 13 ++++++++++++- templates/cinder.conf.j2 | 7 +++++-- vars/main.yml | 3 +++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index dec86063..eff54a5c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -89,7 +89,13 @@ cinder_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers | default('127.0.0.1') }}" cinder_oslomsg_rpc_port: "{{ oslomsg_rpc_port | default('5672') }}" cinder_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl | default(False) }}" cinder_oslomsg_rpc_userid: cinder -cinder_oslomsg_rpc_vhost: /cinder +# vhost name depends on value of oslomsg_rabbit_quorum_queues. In case quorum queues +# are not used - vhost name will be prefixed with leading `/`. +cinder_oslomsg_rpc_vhost: + - name: /cinder + state: "{{ cinder_oslomsg_rabbit_quorum_queues | ternary('absent', 'present') }}" + - name: cinder + state: "{{ cinder_oslomsg_rabbit_quorum_queues | ternary('present', 'absent') }}" cinder_oslomsg_rpc_ssl_version: "{{ oslomsg_rpc_ssl_version | default('TLSv1_2') }}" cinder_oslomsg_rpc_ssl_ca_file: "{{ oslomsg_rpc_ssl_ca_file | default('') }}" @@ -106,6 +112,11 @@ cinder_oslomsg_notify_vhost: "{{ cinder_oslomsg_rpc_vhost }}" cinder_oslomsg_notify_ssl_version: "{{ oslomsg_notify_ssl_version | default('TLSv1_2') }}" cinder_oslomsg_notify_ssl_ca_file: "{{ oslomsg_notify_ssl_ca_file | default('') }}" +## RabbitMQ integration +cinder_oslomsg_rabbit_quorum_queues: "{{ oslomsg_rabbit_quorum_queues | default(True) }}" +cinder_oslomsg_rabbit_quorum_delivery_limit: "{{ oslomsg_rabbit_quorum_delivery_limit | default(0) }}" +cinder_oslomsg_rabbit_quorum_max_memory_bytes: "{{ oslomsg_rabbit_quorum_max_memory_bytes | default(0) }}" + ## (Qdrouterd) integration # TODO(evrardjp): Change structure when more backends will be supported cinder_oslomsg_amqp1_enabled: "{{ cinder_oslomsg_rpc_transport == 'amqp' }}" diff --git a/templates/cinder.conf.j2 b/templates/cinder.conf.j2 index d28764a7..19115b73 100644 --- a/templates/cinder.conf.j2 +++ b/templates/cinder.conf.j2 @@ -55,7 +55,7 @@ backup_ceph_pool = {{ cinder_service_backup_ceph_pool }} executor_thread_pool_size = {{ cinder_rpc_executor_thread_pool_size }} rpc_response_timeout = {{ cinder_rpc_response_timeout }} -transport_url = {{ cinder_oslomsg_rpc_transport }}://{% for host in cinder_oslomsg_rpc_servers.split(',') %}{{ cinder_oslomsg_rpc_userid }}:{{ cinder_oslomsg_rpc_password }}@{{ host }}:{{ cinder_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ cinder_oslomsg_rpc_vhost }}{% if cinder_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ cinder_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ cinder_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +transport_url = {{ cinder_oslomsg_rpc_transport }}://{% for host in cinder_oslomsg_rpc_servers.split(',') %}{{ cinder_oslomsg_rpc_userid }}:{{ cinder_oslomsg_rpc_password }}@{{ host }}:{{ cinder_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ _cinder_oslomsg_rpc_vhost_conf }}{% if cinder_oslomsg_rpc_use_ssl | bool %}?ssl=1&ssl_version={{ cinder_oslomsg_rpc_ssl_version }}&ssl_ca_file={{ cinder_oslomsg_rpc_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} ## Quota quota_volumes = {{ cinder_quota_volumes }} @@ -128,10 +128,13 @@ connection_recycle_time = {{ cinder_db_connection_recycle_time }} [oslo_messaging_rabbit] heartbeat_in_pthread = {{ cinder_oslomsg_heartbeat_in_pthread }} +rabbit_quorum_queue = {{ cinder_oslomsg_rabbit_quorum_queues }} +rabbit_quorum_delivery_limit = {{ cinder_oslomsg_rabbit_quorum_delivery_limit }} +rabbit_quorum_max_memory_bytes = {{ cinder_oslomsg_rabbit_quorum_max_memory_bytes }} [oslo_messaging_notifications] driver = {{ (cinder_ceilometer_enabled | bool) | ternary('messagingv2', 'noop') }} -transport_url = {{ cinder_oslomsg_notify_transport }}://{% for host in cinder_oslomsg_notify_servers.split(',') %}{{ cinder_oslomsg_notify_userid }}:{{ cinder_oslomsg_notify_password }}@{{ host }}:{{ cinder_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ cinder_oslomsg_notify_vhost }}{% if cinder_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ cinder_oslomsg_notify_ssl_version }}&ssl_ca_file={{ cinder_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} +transport_url = {{ cinder_oslomsg_notify_transport }}://{% for host in cinder_oslomsg_notify_servers.split(',') %}{{ cinder_oslomsg_notify_userid }}:{{ cinder_oslomsg_notify_password }}@{{ host }}:{{ cinder_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ _cinder_oslomsg_notify_vhost_conf }}{% if cinder_oslomsg_notify_use_ssl | bool %}?ssl=1&ssl_version={{ cinder_oslomsg_notify_ssl_version }}&ssl_ca_file={{ cinder_oslomsg_notify_ssl_ca_file }}{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} [oslo_concurrency] lock_path = {{ cinder_lock_dir }}/{{ cinder_system_slice_name }} diff --git a/vars/main.yml b/vars/main.yml index ee9c883d..382f8389 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -22,6 +22,9 @@ _cinder_rootwrap_conf_overrides: filters_path: "/etc/cinder/rootwrap.d,/usr/share/cinder/rootwrap" exec_dirs: "{{ cinder_bin }},/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin" +_cinder_oslomsg_rpc_vhost_conf: "{{ (cinder_oslomsg_rpc_vhost is string) | ternary(cinder_oslomsg_rpc_vhost, cinder_oslomsg_rpc_vhost | selectattr('state', 'eq', 'present') | map(attribute='name') | first) }}" +_cinder_oslomsg_notify_vhost_conf: "{{ (cinder_oslomsg_notify_vhost is string) | ternary(cinder_oslomsg_notify_vhost, cinder_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.