[pve-devel] [PATCH qemu-server] api: record VM ID as used after a virtual machine is destroyed
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Sep 26 19:53:03 CEST 2024
Am 26/09/2024 um 15:52 schrieb Severen Redwood:
> After a virtual machine is destroyed, record that its ID has been used
> via the `PVE::UsedVmidList` module so that the `/cluster/nextids`
> endpoint can later optionally avoid suggesting previously used IDs.
>
> Co-authored-by: Daniel Krambrock <krambrock at hrz.uni-marburg.de>
> Signed-off-by: Severen Redwood <severen.redwood at sitehost.co.nz>
> ---
> PVE/API2/Qemu.pm | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index d25a79fe..67a6191f 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -2340,6 +2340,7 @@ __PACKAGE__->register_method({
> });
> };
>
> + PVE::UsedVmidList::add_vmid($vmid);
same here, you write "after a virtual machine is destroyed", but this is quite
a bit before that as the worker might need quite a bit of time to finish, and
that can even fail.
While it's not really causing a issue with recording the VMID as reserved,
that should be evaluated explicitly and mentioned in the commit message.
> return $rpcenv->fork_worker('qmdestroy', $vmid, $authuser, $realcmd);
> }});
>
More information about the pve-devel
mailing list