Force removal of a cinder Volume from the DB

Cinder Volume deletion is possible using commands, in case volume is not able to delete even force remove we have to act from database backend.

1.Get the Cinder list:

#openstack volume list (or) #cinder list

2.From the above command get the volume id which need to remove from the volume list,:

#openstack volume delete <volumeid> (or) cinder delete <volumeid>

3.Now recheck the volume has been removed or not,:

#openstack volume list (or) #cinder list

If Cinder volume is still exist we have to remove the volume from backend database,

1.Before login to the database get the volume id details,:

#cinder list

2.Now check the cinder volume status which is in error_deleting or Detaching and reset to available state,:

#cinder reset-state –state available <volumeid>

3.Login to mysql database and use cinder database,:

#mysql>use cinder;

4.set the cinder volume state available,:

#mysql>update volumes set attach_status=’detached’,status=’available’ where id ='<volumeid’;

5.Comeout from mysql prompt and try to delete the volume using volume id,:

#cinder delete <volumeid>

6.If the above step did not work to delete the volume again login to the mysql and use the cinder database.And follow the below command,:

#mysql>update volumes set deleted=1,status=’deleted’,deleted_at=now(),updated_at=now() where deleted=0 and id='<volumeid>’;