
Hi,
I'm trying to understand the behavior of the "Destroy unreferenced disks owned by this guest" option when deleting a VM.
After looking into the source code (QemuServer.pm), I found that disks listed as unused0, unused1, etc. in the VM config are always deleted regardless of whether this checkbox is checked or not, since foreach_volume_full is called with include_unused => 1.
From what I understand, the checkbox only matters for disks that exist on storage but are NOT referenced in the VM config at all (e.g., created via pvesm alloc manually).
My questions are:
1. What are the realistic scenarios where VM disks remain on storage as orphaned/unreferenced disks after a VM deletion?
2. Is there any way to intentionally leave VM disks on storage after deleting a VM through normal operations (without manually editing the config file or using pvesm alloc)?
3. Are there known cases such as failed migrations, failed clones, or storage errors that can cause this?
Thanks in advance!