If you run into an issue where a Cinder volume you attached to a VM can not be deleted even after detaching it from the VM, and when you look into the logs you find something like
ERROR cinder.volume.manager ....... Unable to delete busy volume.
WARNING cinder.volume.drivers.rbd ......... ImageBusy error raised while deleting rbd volume. This may have been caused by a connection from a client that has crashed and, if so, may be resolved by retrying the delete after 30 seconds has elapsed.
There are multiple scenarios that might cause these errors, among which are:
- Scenario 1: First error message mentioned above, You mighthave created a snapshot of the volume, whether inside cinder or directly from ceph rbd command line. Ceph will not allow you to delete a volume that has snapshots attached to it. The snapshots on the volume can be listed by
rbd snap ls POOLNAME/VOLUMEid
- And then the snapshots can be purged by (only if the snapshots were created outside cinder) :
rbd snap purge POOLNAME/VOLUMEid
If you have the volume snapshots created inside cinder , it’s definitely better to clear them from inside cinder instead.
- Scenario 2: The other scenario is that libvirt on one of the compute nodes is still attached to that volume (the second error message above). This could happen if the VM did not terminate correctly or the detachment didn’t actually happen. To verify that , you will need to list the watchers of the rbd using
rbd status POOLNAME/VOLUMEid
- This will show you the IP of the watcher (the compute node in this case) and the cookie used for the connection
One possibility of this scenario is that a VM did not fully release the volume, i.e detach. To release it, you will have to restart the VM making sure that qemu process has no reference to the volume ID. You might have read that you need reboot the compute node, to release the detachment, but you don’t have to do that if you can just restart the VM with ensuring no attachment to the volume in the qemu process.
Hope that helps !