destroy_vm: remove VM config *after* unused disk removal

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@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Dominic Jäger 2019-10-25 11:24:01 +02:00 committed by Thomas Lamprecht
parent 20faf21e87
commit dfda979e61

View File

@ -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 {