Ask Your Question
2

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

3 answers

Sort by ยป oldest newest most voted
12

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

Comments

Thank you!! this was useful.

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

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):

https://developer.openstack.org/api-r...

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

edit flag offensive delete link more

Comments

I was able to use the API successfully using CURL!

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

Hi,

Can you share the curl procedure? For some reason my cinder refuses to respond properly to curl, and I cannot sort out why ... http://paste.openstack.org/show/729696/

laszlo-budai gravatar imagelaszlo-budai ( 2018-09-07 10:56:48 -0500 )edit
1

answered 2018-08-27 01:38:35 -0500

Arvindr226 gravatar image

Hi, We don't need to update the mysql database table. We can do as below steps.

Step 1: Make sure that you are admin

# source keystone_admin

Step 2-: Get the UUID of the of the volume you need to remove

# cinder list --all

Step 3-: Reset the state to available

# cinder reset-state --state available <UUID>

Step 4-: detached the volume

# cinder reset-state --attach-status detached <UUID>

Step 5-: Delete the volume now

# cinder delete <UUID>
edit flag offensive delete link more

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

3 followers

Stats

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

Seen: 28,828 times

Last updated: Sep 02