-
Notifications
You must be signed in to change notification settings - Fork 23
Add RabbitMQ Quorum queue migration playbook #1224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
be31d10
Add RabbitMQ Quorum queue migration playbook
Alex-Welsh 4e5e88d
Explicitly set RabbitMQ queue types in AIO
Alex-Welsh ad8aa2a
Fix rabbit migration playbook
Alex-Welsh eedc6fa
Refactor RabbitMQ migration playbook into script
Alex-Welsh 5c5afa4
Merge branch 'stackhpc/2023.1' into rabbit-upgrade
Alex-Welsh 9cfefa6
Address RabbitMQ quorum PR nits
Alex-Welsh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
releasenotes/notes/rabbit-migration-script-4721c2e37ac9d3c0.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
features: | ||
- | | ||
Added a script to automate RabbitMQ quorum queue migrations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#! /usr/bin/bash | ||
|
||
set -ex | ||
|
||
RABBITMQ_SERVICES_TO_RESTART=barbican,blazar,cinder,cloudkitty,designate,heat,ironic,keystone,magnum,manila,neutron,nova,octavia | ||
RABBITMQ_CONTAINER_NAME=rabbitmq | ||
|
||
if [[ ! $KAYOBE_CONFIG_PATH ]]; then | ||
echo "Environment variable \$KAYOBE_CONFIG_PATH is not defined" | ||
echo "Ensure your environment is set up to run kayobe commands" | ||
exit 2 | ||
fi | ||
|
||
if [[ ! "$1" = "--skip-checks" ]]; then | ||
# Fail if clocks are not synced | ||
if ! kayobe overcloud host command run -l controllers -b --command "timedatectl status | grep 'synchronized: yes'"; then | ||
echo "Failed precheck: Time not synced on controllers" | ||
echo "Use 'timedatectl status' to check sync state" | ||
echo "Either wait for sync or use 'chronyc makestep'" | ||
exit 1 | ||
fi | ||
kayobe overcloud service configuration generate --node-config-dir /tmp/rabbit-migration --kolla-tags none | ||
# Fail if HA is set or quorum is not | ||
if ! grep 'om_enable_rabbitmq_quorum_queues: true' $KOLLA_CONFIG_PATH/globals.yml || grep 'om_enable_rabbitmq_high_availability: true' $KOLLA_CONFIG_PATH/globals.yml; then | ||
echo "Failed precheck: om_enable_rabbitmq_quorum_queues must be enabled, om_enable_rabbitmq_high_availability must be disabled" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Generate new config, stop services using rabbit, and reset rabbit state | ||
kayobe overcloud service configuration generate --node-config-dir /etc/kolla --kolla-skip-tags rabbitmq-ha-precheck | ||
kayobe kolla ansible run "stop --yes-i-really-really-mean-it" -kt $RABBITMQ_SERVICES_TO_RESTART | ||
kayobe kolla ansible run rabbitmq-reset-state | ||
|
||
if [[ ! "$1" = "--skip-checks" ]]; then | ||
# Fail if any queues still exist | ||
sleep 20 | ||
if kayobe overcloud host command run -l controllers -b --command "docker exec $RABBITMQ_CONTAINER_NAME rabbitmqctl list_queues name --silent | grep -v '^$'"; then | ||
echo "Failed check: RabbitMQ has not stopped properly, queues still exist" | ||
exit 1 | ||
fi | ||
# Fail if any exchanges still exist (excluding those starting with 'amq.') | ||
if kayobe overcloud host command run -l controllers -b --command "docker exec $RABBITMQ_CONTAINER_NAME rabbitmqctl list_exchanges name --silent | grep -v '^$' | grep -v '^amq.'"; then | ||
echo "Failed check: RabbitMQ has not stopped properly, exchanges still exist" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
# Redeploy with quorum queues enabled | ||
kayobe kolla ansible run deploy-containers -kt $RABBITMQ_SERVICES_TO_RESTART | ||
|
||
if [[ ! "$1" = "--skip-checks" ]]; then | ||
Alex-Welsh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sleep 20 | ||
# Assert that at least one quorum queue exists on each controller | ||
if kayobe overcloud host command run -l controllers -b --command "docker exec $RABBITMQ_CONTAINER_NAME rabbitmqctl list_queues type | grep quorum"; then | ||
echo "Queues migrated successfully" | ||
else | ||
echo "Failed post-check: A controller does not have any quorum queues" | ||
fi | ||
fi |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.