mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-11 19:03:07 +00:00
Fix #2412: Missing VMs in pools
Between calling vm_destroy and removing the ID from user.cfg (remove_vm_access) creating a new VM with this ID was possible. VMs could go missing from pools as a consequence. Adding a lock solves this for clones from the same node. Additionally, unlinking must happen at the very end of the deletion process to avoid that other nodes use the ID in the meanwhile. Co-developed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
This commit is contained in:
parent
5c1d42b7f8
commit
3e8e214d73
@ -1492,9 +1492,15 @@ __PACKAGE__->register_method({
|
|||||||
my $upid = shift;
|
my $upid = shift;
|
||||||
|
|
||||||
syslog('info', "destroy VM $vmid: $upid\n");
|
syslog('info', "destroy VM $vmid: $upid\n");
|
||||||
PVE::QemuServer::vm_destroy($storecfg, $vmid, $skiplock);
|
PVE::QemuConfig->lock_config($vmid, sub {
|
||||||
PVE::AccessControl::remove_vm_access($vmid);
|
die "VM $vmid is running - destroy failed\n"
|
||||||
PVE::Firewall::remove_vmfw_conf($vmid);
|
if (PVE::QemuServer::check_running($vmid));
|
||||||
|
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";
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return $rpcenv->fork_worker('qmdestroy', $vmid, $authuser, $realcmd);
|
return $rpcenv->fork_worker('qmdestroy', $vmid, $authuser, $realcmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user