[openstack-dev] [nova] [volume-delete-failure]

zhangtralon ztralon at hotmail.com
Fri Jul 25 09:03:44 UTC 2014


HiHere,there is a problem to discuss with you.Problem: a volume may leave over when we delete an instance   Description:Here, two scenes may cause that a volume is legacy when we delete instance whose task_state is block_device_mapping .The first scene is that using the boot volume created by image creates instance; The other scene is that using image create instance with a volume created through a image.
Reason:Through analyzing, we find that the volume id is not update to block_device_mapping table in DB until a volume created by an image through setting parameters in Blocking Device Mapping v2 is attached to an instance completely.If we delete the instance before the volume id is not update to the block_device_mapping table, the problem mentioned above will occur.
Although the reason of the problem is found, I want to discuss the solution about it with you   
Two examples to reproduce the problem on latest icehousce:
1. the first scene
(1)root at devstack:~# nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
(2)root at devstack:~# nova boot --flavor m1.tiny --block-device id=61ebee75-5883-49a3-bf85-ad6f6c29fc1b,source=image,dest=volume,device=vda,size=1,shutdown=removed,bootindex=0 --nic net-id=354ba9ac-e6a7-4fd6-a49f-6ae18a815e95 tralon_test
root at devstack:~# nova list
+--------------------------------------+-------------+--------+----------------------+-------------+-------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-------------+--------+----------------------+-------------+-------------------+
| 57cbb39d-c93f-44eb-afda-9ce00110950d | tralon_test | BUILD | block_device_mapping | NOSTATE | private=10.0.0.20 |
+--------------------------------------+-------------+--------+----------------------+-------------+-------------------+
(3)root at devstack:~# nova delete tralon_test
root at devstack:~# nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
(4) root at devstack:~# cinder list
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| 3e5579a9-5aac-42b6-9885-441e861f6cc0 | available | None | 1 | None | false | |
| a4121322-529b-4223-ac26-0f569dc7821e | available | | 1 | None | true | |
| a7ad846b-8638-40c1-be42-f2816638a917 | in-use | | 1 | None | true | 57cbb39d-c93f-44eb-afda-9ce00110950d |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
we can see that the instance 57cbb39d-c93f-44eb-afda-9ce00110950d was deleted while the volume still exists with the "in-use" status2. the scend scene
 (1)root at devstack:~# nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
(2)root at devstack:~# nova boot --flavor m1.tiny --image 61ebee75-5883-49a3-bf85-ad6f6c29fc1b --nic net-id=354ba9ac-e6a7-4fd6-a49f-6ae18a815e95 --block-device id=61ebee75-5883-49a3-bf85-ad6f6c29fc1b,source=image,dest=volume,device=vdb,size=1,shutdown=removed tralon_image_instance
root at devstack:~# nova list
+--------------------------------------+-----------------------+--------+----------------------+-------------+-------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+-----------------------+--------+----------------------+-------------+-------------------+
| 25bcfe84-0c3f-40d3-a917-4791e092fa06 | tralon_image_instance | BUILD | block_device_mapping | NOSTATE | private=10.0.0.26 |
+--------------------------------------+-----------------------+--------+----------------------+-------------+-------------------+
(3)root at devstack:~# nova delete 25bcfe84-0c3f-40d3-a917-4791e092fa06
  ( 4 ) root at devstack:~# nova list
+----+------+--------+------------+-------------+----------+
| ID | Name | Status | Task State | Power State | Networks |
+----+------+--------+------------+-------------+----------+
+----+------+--------+------------+-------------+----------+
 (5) root at devstack:~# cinder list
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
| 3e5579a9-5aac-42b6-9885-441e861f6cc0 | available | None | 1 | None | false | |
| a7ad846b-8638-40c1-be42-f2816638a917 | in-use | | 1 | None | true | 57cbb39d-c93f-44eb-afda-9ce00110950d |
| f3df0f15-6c9d-4084-8fb5-dc2826bf3eb0 | in-use | | 1 | None | true | 25bcfe84-0c3f-40d3-a917-4791e092fa06 |
+--------------------------------------+-----------+------+------+-------------+----------+--------------------------------------+
so, the instance 25bcfe84-0c3f-40d3-a917-4791e092fa06 was deleted while the volume f3df0f15-6c9d-4084-8fb5-dc2826bf3eb0 still exists with the "in-use" status 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140725/c8660c24/attachment.html>


More information about the OpenStack-dev mailing list