From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id A3B881FF186 for ; Tue, 5 Nov 2024 16:50:24 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A0DED3313C; Tue, 5 Nov 2024 16:50:34 +0100 (CET) Message-ID: Date: Tue, 5 Nov 2024 16:50:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Severen Redwood , pve-devel@lists.proxmox.com References: <20241105020054.215734-1-severen.redwood@sitehost.co.nz> <20241105020054.215734-4-severen.redwood@sitehost.co.nz> From: Aaron Lauterer In-Reply-To: <20241105020054.215734-4-severen.redwood@sitehost.co.nz> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.037 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH qemu-server v3] api: record VM ID as used after a virtual machine is destroyed X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Cc: t.lamprecht@proxmox.com Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" beside one small nit that could be cleaned up in a follow-up, consider this: Tested-By: Aaron Lauterer Reviewed-By: Aaron Lauterer On 2024-11-05 03:00, Severen Redwood wrote: > 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 > Signed-off-by: Severen Redwood > --- > Changed since v2 is the addition of the use statement for `PVE::UsedVmidList`. > > PVE/API2/Qemu.pm | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm > index 848001b6..8759c1e6 100644 > --- a/PVE/API2/Qemu.pm > +++ b/PVE/API2/Qemu.pm > @@ -52,6 +52,7 @@ use PVE::Replication; > use PVE::ReplicationState; > use PVE::StorageTunnel; > use PVE::RESTEnvironment qw(log_warn); > +use PVE::UsedVmidList qw(add_vmid); same here as in the container, we could probably do without the qw(add_vmid) > > BEGIN { > if (!$ENV{PVE_GENERATING_DOCS}) { > @@ -2335,7 +2336,9 @@ __PACKAGE__->register_method({ > } > } > > - # only now remove the zombie config, else we can have reuse race > + # only now mark the VM ID as previously used and remove the > + # zombie config, else we can have reuse race > + PVE::UsedVmidList::add_vmid($vmid); > PVE::QemuConfig->destroy_config($vmid); > }); > }; _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel