cloudstack
cloudstack copied to clipboard
Destroying VMs also deleting the associated VM Snapshots
ISSUE TYPE
- Improvement Request
COMPONENT NAME
API, UI
CLOUDSTACK VERSION
CloudStack 4.17.0.1
CONFIGURATION
advanced networking
OS / ENVIRONMENT
RHEL 7.9
SUMMARY
The VM Snapshots and VM “Backup & Recovery” are two different things; Currently CloudStack supports the VM backup & recovery by means of third party Veeam Plugin which requires paid subscription. We noticed that when we destroy (without Expunging) VMs, it is also deleting the associated VM Snapshots, in fact we wanted to use these VM snapshots as our recovery points. So, Is it possible to retain the VM snapshots even when the VMs are getting destroyed so that we can pick and choose the desired VM snapshot to recover the VM.
STEPS TO REPRODUCE
step1: Navigate to the desired instances under compute tab, and click "Take VM Snapshot" w/ Snapshot memory & Quiesce VM Enabled
step2: Navigate to Instances, pick the VM and destroy it (without choosing Expunge).
step3: After the VM is destroyed, you will notice that the associated VM Snapshots under Storage tab are also deleted.
EXPECTED RESULTS
Destroying VMs should NOT delete the associated VM Snapshots coz these snapshots can be used to recreate the VM using the desired VM snapshot from of these backed-up VM snapshots.
ACTUAL RESULTS
Destroying VMs also deleting the associated VM Snapshots - the whole chain parent and children VM snapshots
Thanks for opening your first issue here! Be sure to follow the issue template!
@gg4126 this would require some major changes as currently VM snapshots are not backed up on to secondary storage and live in the same dir as the VM (atleast on VMware which I checked). For now using B&R plugin would be a better option
I think the issue is the snapshots are deleted on "VM.DESTROY", instead of on "VM.EXPUNGING". Since the VM can be recovered after being destroyed, but cant be recovered after expunging. So in the "VM.DESTROYED" event process, the snapshots should not be deleted.
@gg4126 I will test again but in my case snapshot wasn't deleted when VM was destroyed and only deleted when the VM was expunged. I was using VMware as hypervisor. Are you using KVM?
@gg4126 I will test again but in my case snapshot wasn't deleted when VM was destroyed and only deleted when the VM was expunged. I was using VMware as hypervisor. Are you using KVM?
Yes, we saw this behavior on KVM based VMs.
@gg4126 on KVM, the vm snapshots are saved as in the qcow2 image file of the vm instance. If the vm is expunged (cloudstack will expunge vm in Destroy state after a period), the vm image is removed, as well as the vm snapshots.
it would be better to use volume snapshots (a.k.a snapshots), which are persisted on primary or secondary storage, instead of vm snapshots.