Deleting a volume booted server which is still in build state leaves behind volume in 'in-use' state
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Undecided
|
Ankit Agrawal |
Bug Description
Deleting a server created using bootable volume which is still in build state leaves behind volume in 'in-use' state and this volume can not be deleted using delete api. Below is the shell script to reproduce it.
curl -g -i -X POST https:/
% Total % Received % Xferd Average Speed Time Time Time Current
100 839 100 436 100 403 589 544 --:--:-- --:--:-- --:--:-- 589
Server Id: 8f04539c-
Request to delete server 8f04539c-
+------
| Property | Value |
+------
| OS-DCF:diskConfig | MANUAL |
| OS-EXT-
| OS-EXT-
| OS-EXT-
| OS-EXT-STS:vm_state | building |
| OS-SRV-
| OS-SRV-
| accessIPv4 | |
| accessIPv6 | |
| config_drive | |
| created | 2015-05-
| flavor | small (da9ba7b5-
| hostId | f96a91b0f7f407d
| id | 8f04539c-
| image | Attempt to boot from volume - no image supplied |
| key_name | - |
| metadata | {} |
| name | testVolIssue |
| os-extended-
| progress | 0 |
| security_groups | default |
| status | BUILD |
| tenant_id | ee61323896a34be
| updated | 2015-05-
| user_id | 6cb8b12bed5046f
+------
nova show 8f04539c-
ERROR (CommandError): No server with a name or ID of '8f04539c-
cinder list | grep 8f04539c-
| 97017c0c-
cinder delete 97017c0c-
Delete for volume 97017c0c-
ERROR: Unable to delete any of the specified volumes.
tags: | added: volumes |
Changed in nova: | |
assignee: | nobody → Ankit Agrawal (ankitagrawal) |
Changed in nova: | |
status: | New → In Progress |
Changed in nova: | |
status: | Fix Committed → Fix Released |
Reviewed: https:/ /review. openstack. org/194063 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=ecdf331bafd dfd2bb8c92d3fd9 6f301bc7ac644f
Committed: https:/
Submitter: Jenkins
Branch: master
commit ecdf331bafddfd2 bb8c92d3fd96f30 1bc7ac644f
Author: ankitagrawal <email address hidden>
Date: Wed Sep 23 03:58:19 2015 -0700
Detach volume after deleting instance with no host
If an instance is booted from a volume, shelved, and goes into an error
state due to some reason. Volume from which instance is booted, remains
in-use state even the instance is deleted because instance has no host
associated with it.
Called _local_delete() to detach volume and destroy bdm if instance is
in shelved_offloaded state or has no host associated with it. This will
cleanup both volumes and the networks.
Note:
I had submitted same patch [1] earlier which was reverted [2] due to a
race condition on jenkins if an instance is deleted when it is in
building state. In this patch I have fixed the failure of race condition
by reverting the ObjectActionError exception handling in _delete.
[1] Ic630ae7d026a96 97afec46ac9ea40 aea0f5b5ffb ed1c1f22ccc972d 45b6d185f41
[2] Id4e405e7579530
Closes-Bug: 1404867 4ebb04eac58ef0c dbf506d6173
Closes-Bug: 1408527
Closes-Bug: 1458308
Change-Id: Ic107d8edc7ee7a