]> git.proxmox.com Git - qemu-server.git/commitdiff
followup: use new base config provided destroy_config method
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Oct 2019 09:12:39 +0000 (11:12 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 18 Oct 2019 09:20:52 +0000 (11:20 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/API2/Qemu.pm
PVE/QemuServer.pm

index 7e1d314762e4609d03c758bf4a3d4914c62a5f13..db436b3d4f2a37abea674eb3584e3776586246a5 100644 (file)
@@ -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);
            });
        };
 
index edb49bc70d28d9b0910d60d84e46adc04ca245b2..9fc81ae47fe18b2c01fc75d4ae908097f62ef052 100644 (file)
@@ -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