Introduction

This feature augments the "destroyVirtualMachine" API by introducing a new request parameter called "volumeids" that allows the user the functionality to remove volumes (data disks) when destroying a guest VM instance. 

Feature Specification

The current implementation of the "destroyVirtualMachine" in CloudStack does not provide the user with an option to also delete the attached volumes (data disks) when destroying guest VMs and this results in unused volumes unless they are manually removed or re-attached to a different VM. This feature aims at to allow VM entity owners to delete any attached columns, either through the API or UI when a VM is being destroyed.

 The UI will have the option to select which volumes should be deleted, or they can select the option to delete none. CloudStack will validate the list of supplied volumes, making sure that the volumes are indeed attached to the VM. If not, the operation will fail. Checks are also done to make sure the volumes are data disks. 

 CloudStack will then detach the selected volumes, destroy the VM, and finally delete the volumesVolumes that are attached to the VM but not requested for deletion will be ignored, and will still exist after the VM has been destroyed. 

Use Cases

  1. User wants to destroy/expunge a VM together with all the volumes attached to it throguh the API or UI.


API

The "destroyVirtualMachine" API command is modified to accept a comma separated list of volume UUIDs that will be deleted. CloudStack will then validate this list, making sure that the volumes are indeed attached to the VM. If not, the operation will fail. Checks are also done to make sure the volumes are data disks. 

Volumes that are attached to the VM but not requested for deletion will be ignored, and will still exist after the VM has been destroyed. 


Usage example with with cloudmonkey of a user destroying a VM with multiple volumes attached. The expected result is that the VM is destroyed along with the specified volumes to be destroyed.

UI Integration

Via UI: Navigate to Instances, select ‘Destroy Instance’, tick ‘Volumes to be deleted’ and tick all applicable volumes 

  • No labels