Skip to content

Commit 3bd8c42

Browse files
committed
Use Quorum queues by default in RabbitMQ
1 parent b37c0ea commit 3bd8c42

File tree

4 files changed

+105
-5
lines changed

4 files changed

+105
-5
lines changed

.github/workflows/stackhpc-all-in-one.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,17 @@ jobs:
344344
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
345345
if: inputs.upgrade
346346

347+
- name: Migrate RabbitMQ queues
348+
run: |
349+
docker run -t --rm \
350+
-v $(pwd):/stack/kayobe-automation-env/src/kayobe-config \
351+
-e KAYOBE_ENVIRONMENT -e KAYOBE_VAULT_PASSWORD -e KAYOBE_AUTOMATION_SSH_PRIVATE_KEY \
352+
${{ steps.kayobe_image.outputs.kayobe_image }} \
353+
/stack/kayobe-automation-env/src/kayobe-config/.automation/pipeline/playbook-run.sh etc/kayobe/ansible/migrate-rabbitmq-queues.yml --tags rabbit-queue-migration
354+
env:
355+
KAYOBE_AUTOMATION_SSH_PRIVATE_KEY: ${{ steps.ssh_key.outputs.ssh_key }}
356+
if: inputs.upgrade
357+
347358
- name: Service upgrade
348359
run: |
349360
docker run -t --rm \
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
---
2+
# Migrate RabbitMQ queues from HA to Quorum
3+
# This is primarily used in CI workflows
4+
5+
- name: Migrate RabbitMQ queues
6+
hosts: localhost
7+
gather_facts: no
8+
vars:
9+
- rabbitmq_container_name: "rabbitmq"
10+
- services_to_restart: "barbican,blazar,cinder,cloudkitty,designate,heat,ironic,keystone,magnum,manila,neutron,nova,octavia"
11+
tasks:
12+
- name: Checking timedatectl status
13+
command: timedatectl status
14+
register: timedatectl_status
15+
changed_when: false
16+
17+
- name: Fail if the clock is not synchronized
18+
assert:
19+
that:
20+
- "'synchronized: yes' not in timedatectl_status.stdout"
21+
fail_msg: >
22+
timedatectl sees the system clock as unsynchronized.
23+
You may need to force synchronisation using `chronyc makestep`.
24+
Otherwise, please wait for synchronization.
25+
26+
- name: Inspect the {{ rabbitmq_container_name }} container
27+
shell:
28+
cmd: "docker container inspect --format '{{ '{{' }} .State.Running {{ '}}' }}' {{ rabbitmq_container_name }}"
29+
register: inspection
30+
become: true
31+
32+
- name: Ensure the {{ rabbitmq_container_name }} container is running
33+
command: "systemctl start kolla-{{ rabbitmq_container_name }}-container.service"
34+
when: inspection.stdout == 'false'
35+
become: true
36+
37+
- name: Wait for the {{ rabbitmq_container_name }} container to reach state 'Running'
38+
shell:
39+
cmd: "docker container inspect --format '{{ '{{' }} .State.Running {{ '}}' }}' {{ rabbitmq_container_name }}"
40+
register: result
41+
until: result.stdout == 'true'
42+
retries: 10
43+
delay: 6
44+
become: true
45+
46+
- name: Wait for the rabbitmq node to automatically start on container start
47+
command: "docker exec {{ rabbitmq_container_name }} /bin/bash -c 'rabbitmqctl wait /var/lib/rabbitmq/mnesia/rabbitmq.pid --timeout 60'"
48+
when: inspection.stdout == 'false'
49+
become: true
50+
51+
- name: Migrate RabbitMQ queues
52+
shell:
53+
cmd: >
54+
kayobe overcloud service configuration generate --node-config-dir /etc/kolla --kolla-skip-tags rabbitmq-ha-precheck -ke om_enable_rabbitmq_quorum_queues=true -ke om_enable_rabbitmq_high_availability=false &&
55+
kayobe kolla ansible run "stop --yes-i-really-really-mean-it" -kt {{ services_to_restart }} -ke om_enable_rabbitmq_quorum_queues=true -ke om_enable_rabbitmq_high_availability=false &&
56+
kayobe kolla ansible run rabbitmq-reset-state -ke om_enable_rabbitmq_quorum_queues=true -ke om_enable_rabbitmq_high_availability=false &&
57+
kayobe kolla ansible run deploy -kt {{ services_to_restart }} -ke om_enable_rabbitmq_quorum_queues=true -ke om_enable_rabbitmq_high_availability=false
58+
executable: /bin/bash
59+
run_once: true
60+
delegate_to: localhost
61+
tags: rabbit-queue-migration
62+
63+
- name: Inspect RabbitMQ queues
64+
shell:
65+
cmd: "docker exec {{ rabbitmq_container_name }} rabbitmqctl list_queues type"
66+
run_once: true
67+
delegate_to: localhost
68+
register: queues
69+
become: true
70+
71+
- name: Assert that queues have been migrated
72+
assert:
73+
that: "{{ 'quorum' in queues.stdout }}"
74+
fail_msg: Queue migration has failed. Run the migration manually.
75+
run_once: true
76+
delegate_to: localhost
77+
78+
- name: Print warning message
79+
debug:
80+
msg: >
81+
Queues have been migrated, now ensure
82+
om_enable_rabbitmq_quorum_queues is set to true in kolla/globals.yml
83+
run_once: true
84+
delegate_to: localhost

etc/kayobe/kolla/globals.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ kolla_image_tags:
2222
# Variables defining which tag to use for each container's image.
2323
{{ lookup('pipe', 'python3 ' ~ kayobe_config_path ~ '/../../tools/kolla-images.py list-tag-vars') }}
2424

25-
#############################################################################
26-
# RabbitMQ
27-
28-
om_enable_rabbitmq_high_availability: true
29-
3025
#############################################################################
3126
# Monitoring and alerting related settings
3227

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
features:
3+
- |
4+
RabbitMQ will now use quorum queues by default, rather than traditional HA.
5+
upgrade:
6+
- |
7+
RabbitMQ will now use quorum queues by default. See the `kolla-ansible
8+
documentation
9+
<https://docs.openstack.org/kolla-ansible/latest/reference/message-queues/rabbitmq.html#high-availability>`__
10+
for migration advice.

0 commit comments

Comments
 (0)