Add command to force reset the state of RabbitMQ

This command can be invoked with ``kolla-ansible rabbitmq-reset-state``.
This is primarily designed to be used when enabling HA queues[1].

As such, this also updates the RabbitMQ documentation to use this
command.

[1] https://docs.openstack.org/kolla-ansible/latest/reference/message-queues/rabbitmq.html#high-availability

Change-Id: I6ad95a3618fc1a34af56657ef99ef14dc979f17a
This commit is contained in:
Matt Crees 2023-08-02 16:30:31 +01:00 committed by Michal Nasiadka
parent d1a52b5816
commit 60282285bd
5 changed files with 60 additions and 11 deletions

View File

@ -0,0 +1,10 @@
---
- name: Reset RabbitMQ state
hosts: rabbitmq
tasks:
- name: Include RabbitMQ reset-state tasks
include_role:
name: rabbitmq
tasks_from: reset-state
when:
- enable_rabbitmq | bool

View File

@ -0,0 +1,16 @@
---
- name: Stop the RabbitMQ application
become: true
command: "{{ kolla_container_engine }} exec rabbitmq rabbitmqctl stop_app"
- name: Reset the state of RabbitMQ
become: true
command: "{{ kolla_container_engine }} exec rabbitmq rabbitmqctl force_reset"
- name: Start the RabbitMQ application
become: true
command: "{{ kolla_container_engine }} exec rabbitmq rabbitmqctl start_app"
- name: Wait for all RabbitMQ nodes to join the cluster
become: true
command: "{{ kolla_container_engine }} exec rabbitmq rabbitmqctl await_online_nodes {{ groups['rabbitmq'] | length }}"

View File

@ -125,22 +125,32 @@ needed to migrate from transient to durable queues.
1. Stop all OpenStack services which use RabbitMQ, so that they will not 1. Stop all OpenStack services which use RabbitMQ, so that they will not
attempt to recreate any queues yet. attempt to recreate any queues yet.
2. Reconfigure RabbitMQ to enable classic queue mirroring. .. code-block:: console
kolla-ansible stop --tags <service-tags>
2. Generate the new config for all services.
.. code-block:: console .. code-block:: console
kolla-ansible reconfigure --tags rabbitmq --skip-tags rabbitmq-ha-precheck kolla-ansible genconfig
3. Reset the state on each RabbitMQ node with the following commands. Each 3. Reconfigure RabbitMQ.
command must be run on all RabbitMQ nodes before moving on to the next
command. This will remove all queues.
.. code-block:: console .. code-block:: console
rabbitmqctl stop_app kolla-ansible reconfigure --tags rabbitmq
rabbitmqctl force_reset
rabbitmqctl start_app
4. Reconfigure the OpenStack services using ``kolla-ansible reconfigure``, at 4. Reset the state on each RabbitMQ, to remove the old transient queues and
which point they will start again and recreate the appropriate queues as exchanges.
durable.
.. code-block:: console
kolla-ansible rabbitmq-reset-state
5. Start the OpenStack services again, at which point they will recreate the
appropriate queues as durable.
.. code-block:: console
kolla-ansible deploy --tags <service-tags>

View File

@ -0,0 +1,7 @@
---
features:
- |
The new command ``kolla-ansible rabbitmq-reset-state`` has been added. It
force-resets the state of RabbitMQ. This is primarily designed to be used
when enabling HA queues, see docs:
https://docs.openstack.org/kolla-ansible/latest/reference/message-queues/rabbitmq.html#high-availability

View File

@ -193,6 +193,7 @@ Commands:
gather-facts Gather Ansible facts gather-facts Gather Ansible facts
post-deploy Do post deploy on deploy node post-deploy Do post deploy on deploy node
pull Pull all images for containers (only pulls, no running container changes) pull Pull all images for containers (only pulls, no running container changes)
rabbitmq-reset-state Force reset the state of RabbitMQ
reconfigure Reconfigure OpenStack service reconfigure Reconfigure OpenStack service
stop Stop Kolla containers stop Stop Kolla containers
certificates Generate self-signed certificate for TLS *For Development Only* certificates Generate self-signed certificate for TLS *For Development Only*
@ -241,6 +242,7 @@ deploy-servers
gather-facts gather-facts
post-deploy post-deploy
pull pull
rabbitmq-reset-state
reconfigure reconfigure
stop stop
certificates certificates
@ -567,6 +569,10 @@ EOF
ACTION="Cleanup disabled nova_libvirt containers" ACTION="Cleanup disabled nova_libvirt containers"
PLAYBOOK="${BASEDIR}/ansible/nova-libvirt-cleanup.yml" PLAYBOOK="${BASEDIR}/ansible/nova-libvirt-cleanup.yml"
;; ;;
(rabbitmq-reset-state)
ACTION="Force reset the state of RabbitMQ"
PLAYBOOK="${BASEDIR}/ansible/rabbitmq-reset-state.yml"
;;
(bash-completion) (bash-completion)
bash_completion bash_completion
exit 0 exit 0