From dfda979e61f5b91921ac9de4655f44f8c9f6296f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominic=20J=C3=A4ger?= Date: Fri, 25 Oct 2019 11:24:01 +0200 Subject: [PATCH] destroy_vm: remove VM config *after* unused disk removal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As mentioned on the mailing list [0] disks owned by the VM and unused disks should be removed before the config file is removed. [0] https://pve.proxmox.com/pipermail/pve-devel/2019-October/039593.html Signed-off-by: Dominic Jäger Signed-off-by: Thomas Lamprecht --- PVE/QemuServer.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index d24de701..328a0d15 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -2592,12 +2592,6 @@ sub destroy_vm { }); - if ($keep_empty_config) { - PVE::QemuConfig->write_config($vmid, { memory => 128 }); - } else { - PVE::QemuConfig->destroy_config($vmid); - } - # also remove unused disk eval { my $dl = PVE::Storage::vdisk_list($storecfg, undef, $vmid); @@ -2612,6 +2606,12 @@ sub destroy_vm { }; warn $@ if $@; + + if ($keep_empty_config) { + PVE::QemuConfig->write_config($vmid, { memory => 128 }); + } else { + PVE::QemuConfig->destroy_config($vmid); + } } sub parse_vm_config {