Ask Your Question

How to delete volume with available status and attached to

asked 2015-05-15 03:26:44 -0500

xiangfeiz gravatar image

Somehow I got a large number of cinder volumes in available status but have an instance ID in its "attached to". The instance of the instance ID has been deleted in nova. I know this is a bug to enter that state. But with it, how can I delete the volume in this state? By the way, I have tried 'force-delete' and that does not allow me to delete it.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2015-05-15 04:25:11 -0500

sunnyarora gravatar image

updated 2015-05-15 07:38:28 -0500

So, there is a workaround for doing this via mysql db, but i would not recommend directly to make changes in DB. But that works.

Step 1: Get volume uuid by running cinder list command

 [root@controller ~(openstack_admin)]#cinder list

Step2: You can check the available status and try to reset the state of volume, if that shows "Error_deleting" or "Detaching" Then you can reset-state of the volume from

[root@controller ~(openstack_admin)]#cinder reset-state --state available $volume_uuid

If that also fails, Login to mysql db and use cinder DB

mysql> use cinder;

-following cinder mysql query sets the Cinder state to available:

mysql>update volumes set attach_status='detached',status='available' where id ='$volume_uuid';

or you can also specify more options like setting up instance uuid to NULL and attach time to NULL.

mysql>update volumes set attach_status='detached',instance_uuid=NULL,attach_time=NULL,status="available" WHERE id='volume_uuid';

Step 3: Now again try deleting the effected volume

[root@controller~(openstack_admin)]#cinder delete $volume_uuid

Step 4: if the above workflow dont help then below mysql query will delete the volume

mysql>update volumes set deleted=1,status='deleted',deleted_at=now(),updated_at=now() where deleted=0 and id='$volume_uuid';
edit flag offensive delete link more


Thank you!! this was useful.

TijoV gravatar imageTijoV ( 2018-02-07 03:06:20 -0500 )edit

answered 2018-02-16 10:04:29 -0500

mriedem gravatar image

Resetting the volume state won't remove any orphaned attachment records for the volume. It's better to use the force detach API (defaults to admin-only):

Unfortunately there are no CLIs for this in python-cinderclient or python-openstackclient yet.

edit flag offensive delete link more


I was able to use the API successfully using CURL!

zioproto gravatar imagezioproto ( 2018-05-25 06:44:00 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools



Asked: 2015-05-15 03:26:44 -0500

Seen: 25,812 times

Last updated: Feb 16