[pve-devel] applied: [PATCH qemu-server 1/2] followup: use new base config provided destroy_config method

Thomas Lamprecht t.lamprecht at proxmox.com
Fri Oct 18 11:23:58 CEST 2019


Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 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 7e1d314..db436b3 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 edb49bc..9fc81ae 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
-- 
2.20.1





More information about the pve-devel mailing list