If the instance is booted from volume and goes in to error state due to some reason.
Volume from which instance is booted, remains in-use state even the instance is deleted.
IMO, volume should be detached so that it can be used to boot other instance.
Steps to reproduce:
1. Log in to Horizon, create a new volume.
2. Create an Instance using newly created volume.
3. Verify instance is in active state.
$ source devstack/openrc demo demo
$ nova list
+--------------------------------------+------+--------+------------+-------------+------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------+--------+------------+-------------+------------------+
| dae3a13b-6aa8-4794-93cd-5ab7bf90f604 | nova | ACTIVE | - | Running | private=10.0.0.3 |
+--------------------------------------+------+--------+------------+-------------+------------------+
Note:
Use shelve-unshelve api to see the instance goes into error state.
unshelving volume back instance does not work and sets instance state to error (ref: https://bugs.launchpad.net/nova/+bug/1404801)
4. Shelve the instance
$ nova shelve <instance-uuid>
5. Verify the status is SHELVED_OFFLOADED.
$ nova list
+--------------------------------------+------+-------------------+------------+-------------+------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------+-------------------+------------+-------------+------------------+
| dae3a13b-6aa8-4794-93cd-5ab7bf90f604 | nova | SHELVED_OFFLOADED | - | Shutdown | private=10.0.0.3 |
+--------------------------------------+------+-------------------+------------+-------------+------------------+
6. Unshelve the instance.
$ nova unshelve <instance-uuid>
5. Verify the instance is in Error state.
$ nova list
+--------------------------------------+------+-------------------+------------+-------------+------------------+
| ID | Name | Status | Task State | Power State | Networks |
+--------------------------------------+------+-------------------+------------+-------------+------------------+
| dae3a13b-6aa8-4794-93cd-5ab7bf90f604 | nova | Error | unshelving | Spawning | private=10.0.0.3 |
+--------------------------------------+------+-------------------+------------+-------------+------------------+
6. Delete the instance using Horizon.
7. Verify that volume still in in-use state
$ cinder list
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
| 4aeefd25-10aa-42c2-9a2d-1c89a95b4d4f | in-use | test | 1 | lvmdriver-1 | true | 8f7bdc24-1891-4bbb-8f0c-732b9cbecae7 |
+--------------------------------------+--------+------+------+-------------+----------+--------------------------------------+
8. In Horizon, volume "Attached To" information is displayed as "Attached to None on /dev/vda".
9. User is not able to delete this volume, or attached it to another instance as it is still in use.
If the instance is booted from volume and goes in to error state due to some reason.
Volume from which instance is booted, remains in-use state even the instance is deleted.
IMO, volume should be detached so that it can be used to boot other instance.
Steps to reproduce:
1. Log in to Horizon, create a new volume. ------- ------- ------- ------- ----+-- ----+-- ------+ ------- -----+- ------- -----+- ------- ------- ---+ ------- ------- ------- ------- ----+-- ----+-- ------+ ------- -----+- ------- -----+- ------- ------- ---+ 6aa8-4794- 93cd-5ab7bf90f6 04 | nova | ACTIVE | - | Running | private=10.0.0.3 | ------- ------- ------- ------- ----+-- ----+-- ------+ ------- -----+- ------- -----+- ------- ------- ---+
2. Create an Instance using newly created volume.
3. Verify instance is in active state.
$ source devstack/openrc demo demo
$ nova list
+------
| ID | Name | Status | Task State | Power State | Networks |
+------
| dae3a13b-
+------
Note: /bugs.launchpad .net/nova/ +bug/1404801)
Use shelve-unshelve api to see the instance goes into error state.
unshelving volume back instance does not work and sets instance state to error (ref: https:/
4. Shelve the instance
$ nova shelve <instance-uuid>
5. Verify the status is SHELVED_OFFLOADED. ------- ------- ------- ------- ----+-- ----+-- ------- ------- ---+--- ------- --+---- ------- --+---- ------- ------- + ------- ------- ------- ------- ----+-- ----+-- ------- ------- ---+--- ------- --+---- ------- --+---- ------- ------- + 6aa8-4794- 93cd-5ab7bf90f6 04 | nova | SHELVED_OFFLOADED | - | Shutdown | private=10.0.0.3 | ------- ------- ------- ------- ----+-- ----+-- ------- ------- ---+--- ------- --+---- ------- --+---- ------- ------- +
$ nova list
+------
| ID | Name | Status | Task State | Power State | Networks |
+------
| dae3a13b-
+------
6. Unshelve the instance.
$ nova unshelve <instance-uuid>
5. Verify the instance is in Error state. ------- ------- ------- ------- ----+-- ----+-- ------- ------- ---+--- ------- --+---- ------- --+---- ------- ------- + ------- ------- ------- ------- ----+-- ----+-- ------- ------- ---+--- ------- --+---- ------- --+---- ------- ------- + 6aa8-4794- 93cd-5ab7bf90f6 04 | nova | Error | unshelving | Spawning | private=10.0.0.3 | ------- ------- ------- ------- ----+-- ----+-- ------- ------- ---+--- ------- --+---- ------- --+---- ------- ------- +
$ nova list
+------
| ID | Name | Status | Task State | Power State | Networks |
+------
| dae3a13b-
+------
6. Delete the instance using Horizon.
7. Verify that volume still in in-use state ------- ------- ------- ------- ----+-- ------+ ------+ ------+ ------- ------+ ------- ---+--- ------- ------- ------- ------- ------- + ------- ------- ------- ------- ----+-- ------+ ------+ ------+ ------- ------+ ------- ---+--- ------- ------- ------- ------- ------- + 10aa-42c2- 9a2d-1c89a95b4d 4f | in-use | test | 1 | lvmdriver-1 | true | 8f7bdc24- 1891-4bbb- 8f0c-732b9cbeca e7 | ------- ------- ------- ------- ----+-- ------+ ------+ ------+ ------- ------+ ------- ---+--- ------- ------- ------- ------- ------- +
$ cinder list
+------
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+------
| 4aeefd25-
+------
8. In Horizon, volume "Attached To" information is displayed as "Attached to None on /dev/vda".
9. User is not able to delete this volume, or attached it to another instance as it is still in use.