At some point, you will no longer need the volumes you have created. To remove the volumes from the system permanently, so they are no longer available, we simply pull out another tool from the OpenStack client, the volume delete
option.
To delete a volume, you will need the following:
openstack
command-line clientopenrc
file with appropriate credentials for the environmentFor our example, these values are as follows:
cookbook.volume
To delete a volume using the OpenStack client, carry out the following steps:
openstack volume list
This shows that the volume is available and not attached to any instance:
openstack volume delete cookbook.volume
How the actual volume is deleted depends largely on the Cinder volume driver. In the Configuring Cinder volume services recipe of this chapter, we used cinder.volume.drivers.lvm.LVMVolumeDriver
. In this case, deleting images removes the LVM volume from use within our system.
OpenStack Cinder volumes can be snapshotted, in which case, the openstack volume delete
command will produce an error message like the following:
Invalid volume: Volume status must be available or error or error_restoring or error_extending or error_managing and must not be migrating, attached, belong to a group, have snapshots or be disassociated from snapshots after volume transfer. (HTTP 400) (Request-ID: req-2b82e7fc-0cb4-403f-8dd8-35d99a0f6c6c)
To delete a volume, and all of its snapshots, pass the --purge
flag to the openstack volume delete
command.
18.188.151.107