From 5172770df7a7cb4b099039400cb65f78974a5af2 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Fri, 18 Oct 2019 11:12:39 +0200 Subject: [PATCH] followup: use new base config provided destroy_config method Signed-off-by: Thomas Lamprecht --- PVE/API2/Qemu.pm | 5 +++-- PVE/QemuServer.pm | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 7e1d3147..db436b3d 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1498,8 +1498,9 @@ __PACKAGE__->register_method({ PVE::QemuServer::destroy_vm($storecfg, $vmid, 1, $skiplock); PVE::AccessControl::remove_vm_access($vmid); PVE::Firewall::remove_vmfw_conf($vmid); - unlink PVE::QemuConfig->config_file($vmid) - or die "Removal of VM $vmid config file failed: $!\n"; + + # only now remove the zombie config, else we can have reuse race + PVE::QemuConfig->destroy_config($vmid); }); }; diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index edb49bc7..9fc81ae4 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -2665,7 +2665,7 @@ sub destroy_vm { if ($keep_empty_config) { PVE::Tools::file_set_contents($conffile, "memory: 128\n"); } else { - unlink $conffile; + PVE::QemuConfig->destroy_config($vmid); } # also remove unused disk