How to delete a volume that returns error: "Volume still has 1 dependent snapshots. (HTTP 400)"¶
If you create a volume and then a snapshot of the volume you will not be able to delete the volume before deleting the snapshot. This is what usually happens if you do it from the command line:
Create a volume¶
openstack volume create test --size 10
+---------------------+--------------------------------------+
| Field | Value |
+---------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2016-07-25T10:27:14.699904 |
| description | None |
| encrypted | False |
| id | 403bbc15-1da8-4800-8b94-1b38f3b5017e |
| migration_status | None |
| multiattach | False |
| name | test |
| properties | |
| replication_status | disabled |
| size | 10 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | None |
| user_id | anmess |
+---------------------+--------------------------------------+
Create a snapshot of the volume¶
openstack snapshot create --name test-snap test
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| created_at | 2016-07-25T10:27:23.569200 |
| description | None |
| id | bdb64d1c-2803-4f09-820a-4e3769889804 |
| name | test-snap |
| properties | |
| size | 10 |
| status | creating |
| volume_id | 403bbc15-1da8-4800-8b94-1b38f3b5017e |
+-------------+--------------------------------------+
Try to delete the volume¶
openstack volume delete test
Invalid volume: Volume still has 1 dependent snapshots. (HTTP 400) (Request-ID: req-356dcc18-1b77-47bd-9f63-ac4d876af532)
To solve this issue you need to delete the snapshot first.
Delete the dependent snapshot¶
openstack snapshot delete test-snap
Delete the volume¶
openstack volume delete test