Auto Deleting Volumes on Instance Delete
Problem
How to attach Volumes which will be deleted when the Source VM is deleted.
Environment
- Platform9 Managed OpenStack - v4.0 and Higher
- python-openstackclient CLI
Procedure
- Obtain the UUID of the Volume and the VM you want to attach it to.
- Source the OpenRC file for your environment.
- Run the following command with the
--enable-delete-on-termination
flag.$ openstack server add volume [--enable-delete-on-termination | --disable-delete-on- termination] server_uuid volume_uuid
Note - This command will delete the volume by default when the associated VM is deleted. There will no confirmation step. Please ensure you have backups of all critical volumes to avoid potential data loss.
Additional Information
- How to use the OpenStack CLI.
- Upstream OpenStack Documentation
Was this page helpful?