You can use the queue_dump.py tool to inspect the OpenStack RabbitMQ notifications by displaying the messages and re-queueing them.
You can also use it to completely drain a rabbitmq queue, destroying all messages.
-
Create a python virtual environment and install pika:
pip install -r requirements.txt -
Grab the rabbitmq credentials from kubernetes:
export RABBIT_USER=$(kubectl -n openstack get secret rabbitmq-default-user -o jsonpath="{.data.username}" | base64 --decode)
export RABBIT_PASS=$(kubectl -n openstack get secret rabbitmq-default-user -o jsonpath="{.data.password}" | base64 --decode)
- Open a port to the rabbitmq server:
kubectl -n openstack port-forward svc/rabbitmq 5672
-
Use RabbitMq management UI to know more about Virtualhosts, Exchanges, Queues etc, follow the instructions provided here:
-
Run the
queue_dump.pytool:
python queue_dump.py -h
usage: queue-dump [-h] -u USERNAME -p PASSWORD [--host HOST] [--port PORT] [--virtualhost VIRTUALHOST] [--queue QUEUE] [-v] [--destroy]
dump, print, list-events, and requeue an openstack notifications rabbitmq queue
options:
-h, --help show this help message and exit
-u USERNAME, --username USERNAME
RabbitMQ username
-p PASSWORD, --password PASSWORD
RabbitMQ password
--host HOST RabbitMQ hostname
--port PORT RabbitMQ port
--virtualhost VIRTUALHOST
RabbitMQ virtual host
--queue QUEUE RabbitMQ queue
-v, --verbose Increase output verbosity
--destroy Warning: Destroys all messages!
python queue_dump.py -u $RABBIT_USER -p $RABBIT_PASS
If you want to understand what are the different event-types being emitted by OpenStack notifications system, you can use:
python queue_dump.py --virtualhost $VIRTUAL_HOST -u $RABBIT_USER -p $RABBIT_PASS --queue notifications.info --list-event-types
If you need to find a specific event type to troubleshoot something, you can use:
python queue_dump.py -u $RABBIT_USER -p $RABBIT_PASS --event-type baremetal.node.power_set.start
I needed to find the notification payload for OpenStack Ironic clean failed events:
python queue_dump.py -u $RABBIT_USER -p $RABBIT_PASS --provision-state 'clean failed'
Warning: This is a destructive action!
python queue_dump.py -u $RABBIT_USER -p $RABBIT_PASS --destroy
