When trying to remove an image with rbd, you might have encountered this error:
rbd: error: image still has watchers This means the image is still open or the client using it crashed. Try again after closing/unmapping it or waiting 30s for the crashed client to timeout.
To try and remove this lock is a nightmare when Googling around for a solution. The first step is to identify what is locking this image.
rbd lock ls your_image_name -p your_pool_name
This will list Locker, ID, and Address information. Use this information and substitute into the following command:
rbd lock rm your_image_name auto\ ID_NUMBER_FROM_PREVIOUS_COMMAND LOCKER_VALUE_FROM_PREVIOUS_COMMAND -p your_pool_name
The command to run will look similar to: DO NOT RUN THE FOLLOWING COMMAND, it is just a reference for what the command ought to look like
rbd lock rm vm-156-disk-0 auto\ 125825167285890 client.125274589 -p my_pool
The lock is now removed on the image, and you can remove the RBD image without issue:
rbd rm -f your_image_name -p your_pool_name