[pve-devel] [PATCH qemu-server 1/7] Move config removal after disk removal

Dominic Jäger d.jaeger at proxmox.com
Fri Oct 25 11:24:01 CEST 2019


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 <d.jaeger at proxmox.com>
---
 PVE/QemuServer.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index d24de70..328a0d1 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 {
-- 
2.20.1




More information about the pve-devel mailing list