Cinder volume operations
Delete Orphan volumes
We have some volumes seemingly attached to an instance, but the instance is deleted

These can't be deleted

We can reset the state and attachment status
cinder reset-state --state available --attach-status detached <VOLUME_ID>

And now we're able to delete it
openstack volume delete <VOLUME_ID>

Delete orphan volumes on offlined hosts
If the host the orphan volumes resided on is offline or decommissioned we might have to remove the volumes from the database manually. Plese try the steps in the Delete Orphan volumes section first!
Note the two volumes stuck in deleting

sudo mysql
List volumes in deleting
Note that we're dealing with volumes which is NOT attached to anything. If the
attach_statusis not set to detach we'd probably need to fix other tables as well
use cinder;
select id,status,attach_status,host from volumes where status = 'deleting';
--select id,status,attach_status,host from volumes where id = '<VOLUME_ID>';

Let's update the volumes so that the host column is NULL. Note that we also update the status to be able to run the proper delete command from the CLI/API.
update volumes set host = NULL, status = 'available' where id = '<VOLUME_ID>';

Note that we're only updating the record for one volume, we could use the same where clause as previously to do this for all
deletingvolumes at once
After updating the records we can verify it
select id,status,attach_status,host from volumes where status = 'available';

Note that since we've updated the status we can't use the same where clause as before
Now we can exit the database client and go back to the delete command from the openstack cli
openstack volume delete <VOLUME_ID>
Repeat for all volumes that is to be deleted
Verify that volumes are deleted
openstack volume list

Note that there might still be references in the database for these volumes and their attachments.
Create volume from image
openstack volume create --size 20 --image ubuntu-22.04 --type nas my-nas-root