Openstack Queens – Cinder: Deleting volumes using Mysql

Sometimes things get so broken you just have to hack stuff out of the database because the API’s are in a stuck state.

Here is what I did to successfully remove the volume entries for some stuck volumes after a MySQL server crash.

Note, You’ll also need to adjust the quotas table too to decrement the number of volumes used by that users

set @id :="b9840e99-f9f6-4a80-9dcc-dc51898d9cb3"; 
update cinder.volumes set status="available",attach_status="detached" where id=@id;
update cinder.volume_attachment set attach_status="detached",detach_time="2018-04-22 09:16:33",deleted=1,deleted_at="2018-04-23 08:16:33",updated_at="2018-04-23 08:16:33" where volume_id=@id;

Another little trick is to manually set volumes into an error state if they get stuck in a “Creating” state

update cinder.volumes set status="error" where status="creating";