Ensure no CQ mirroring policies applied

During migration to Quorum queues we have renamed vhosts
to not contain leading slash for them. However, some services
at the same time were configured not to have RPC messaging,
but only notifications whenever needed - like keystone, glance, etc.

This left such vhosts still containing HA policy on them, leading
to RabbitMQ upgrade failures with:
```
rabbitmq-server[2934794]: Application rabbit exited with reason:
{{failed_to_deny_deprecated_features,[classic_queue_mirroring]},{rabbit,start,[normal,[]]}}
```

This patch implements a check of deprecated feature flags and
disables all HA policies across the board before upgrade happens.

As we don't want to force removal when running RabbitMQ 3.13,
the removal is enforced only during upgrade to 4.0.
Conditions are maintained on a task level rather then a block
to make it extendable with other deprecated flags in the future.

Change-Id: I372421e0347687a1d861b548fd20ee92b150c301
Signed-off-by: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com>
This commit is contained in:
Dmitriy Rabotyagov
2025-08-25 13:23:20 +02:00
parent e346e79ed3
commit 1a9074c590
2 changed files with 31 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
---
fixes:
- |
Fixed RabbitMQ upgrade issue for older deployments which had
previously used RabbitMQ Classic Queue mirroring (HA Queues)
by implementing an upgrade check and disabling leftover
policies on upgrade.

View File

@@ -27,3 +27,27 @@
loop: "{{ _feature_flags.stdout | from_json | rejectattr('stability', 'eq', 'experimental') | selectattr('state', 'eq', 'disabled') }}"
loop_control:
loop_var: flag
- name: Check for deprecated features
when:
- rabbitmq_upgrade | bool
tags:
- rabbitmq-upgrade
block:
- name: Check for deprecated features
ansible.builtin.command: rabbitmq-diagnostics check_if_any_deprecated_features_are_used --formatter json
changed_when: false
failed_when: false
register: deprecated_features
- name: Disable classic queues if still used
vars:
parsed_deprecations: "{{ ((deprecated_features.rc == 0) | ternary(deprecated_features.stdout, deprecated_features.stderr)) | from_json }}"
ansible.builtin.command: rabbitmqctl remove_classic_queue_mirroring_from_policies
changed_when: true
when:
- rabbitmq_package_version is version('4.0', '>=')
- installed_rabbitmq.rc == 0
- installed_rabbitmq.stdout is version('4.0', '<')
- parsed_deprecations.result == 'error'
- "'classic_queue_mirroring' in parsed_deprecations.deprecated_features"