]> git.proxmox.com Git - qemu-server.git/commitdiff
vm destroy: destroy also unusedX config entries
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 25 Jan 2021 14:49:39 +0000 (15:49 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 25 Jan 2021 14:49:41 +0000 (15:49 +0100)
this was previously covered by the "lets destroy ever disk which
matches the VMID" feature we disarmed a bit.

As unused disks are referenced in the config, it is not subtle to
destroy them (and we always did in the past) so fix that regression
again for explicitly referenced but unused disks.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/QemuServer.pm

index eb2270c52c9073cbf1f5eb8656c7a77d96ca213f..8678beff607413c06a1e7605cfc53a08868ae61f 100644 (file)
@@ -2095,8 +2095,8 @@ sub destroy_vm {
        });
     }
 
-    # only remove disks owned by this VM
-    PVE::QemuConfig->foreach_volume($conf, sub {
+    # only remove disks owned by this VM (referenced in the config)
+    PVE::QemuConfig->foreach_volume_full($conf, { include_unused => 1 }, sub {
        my ($ds, $drive) = @_;
        return if drive_is_cdrom($drive, 1);