From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id AD7591FF136 for ; Mon, 23 Mar 2026 17:04:35 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9F14431846; Mon, 23 Mar 2026 17:04:52 +0100 (CET) Date: Mon, 23 Mar 2026 17:04:15 +0100 From: Arthur Bied-Charreton To: Fiona Ebner Subject: Re: [PATCH qemu-server 8/8] api: qemu: Add CRUD handlers for custom CPU models Message-ID: <3ddcijjmqsdhblts56mfczmphzd52mdcnotiamyd3zsnfudhzh@624zuthx4tnk> References: <20260312084021.124465-1-a.bied-charreton@proxmox.com> <20260312084021.124465-9-a.bied-charreton@proxmox.com> <1dd87137-0907-453d-8add-4c4dfdfe73ea@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1dd87137-0907-453d-8add-4c4dfdfe73ea@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774281810837 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.697 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 POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: OYF7KCZALBP6JJUOFHIBCSZPBQKGW5NJ X-Message-ID-Hash: OYF7KCZALBP6JJUOFHIBCSZPBQKGW5NJ X-MailFrom: a.bied-charreton@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Mon, Mar 23, 2026 at 03:46:45PM +0100, Fiona Ebner wrote: > Am 12.03.26 um 9:40 AM schrieb Arthur Bied-Charreton: > > Add GET handlers for both all custom CPU models and specific ones, POST > > handler for creating custom CPU models, PUT handler for updating them, > > and DELETE handler for deleting them. > > > > Original patches: > > https://lore.proxmox.com/pve-devel/20211028114150.3245864-4-s.reiter@proxmox.com/ > > https://lore.proxmox.com/pve-devel/20211028114150.3245864-5-s.reiter@proxmox.com/ > > > > Originally-by: Stefan Reiter > > Signed-off-by: Arthur Bied-Charreton > > --- > > src/PVE/API2/Qemu/CPU.pm | 236 ++++++++++++++++++++++++++++++++++++++- > > 1 file changed, 235 insertions(+), 1 deletion(-) > > > > diff --git a/src/PVE/API2/Qemu/CPU.pm b/src/PVE/API2/Qemu/CPU.pm > > index f8a7e11d..9d89504d 100644 > > --- a/src/PVE/API2/Qemu/CPU.pm > > +++ b/src/PVE/API2/Qemu/CPU.pm > > @@ -52,7 +52,7 @@ __PACKAGE__->register_method({ > > }, > > }, > > }, > > - links => [{ rel => 'child', href => '{name}' }], > > + links => [{ rel => 'child', href => 'model/{cputype}' }], > > Pre-existing issues from the original series: > > This does not work in pvesh, because the extract_children() function > there only matches: > > if ($href =~ m/^\{(\S+)\}$/) { > I should have tested that, sorry.. > Also, it's called 'name' in the returned result, not 'cputype'. > > But this is the wrong place for a link to begin with, since we only want > to provide the link for custom models, it should be added to the 'model' > endpoint. There, it is called 'cputype' ;) > > Having the 'model' endpoint below here seems wrong to me, for two reasons: > > 1. Since the 'cpu' endpoint already returns a result other than an index > of sub-endpoints, it cannot at the same time show in its result that the > sub-endpoint exists, and this breaks the directory structure. > > 2. It's below /nodes/ but it's touching cluster-wide configuration. > > I think we should just have a new, dedicated endpoint, maybe > /cluster/qemu/custom-cpu-models? And then, we might want to drop the > need for specifying a 'custom-' prefix when using the calls? I agree that the current state feels weird. I went with the old patch's approach but I should have rethought it a bit more, especially the custom- prefix, the URL already carries that so it's quite redundant. I like the idea of a new /cluster/qemu/custom-cpu-models route, will move the endpoint over to pve-manager for v2 and drop the custom- prefix in the process. By that logic, the cpu-flags endpoint should probably also be cluster-wide, since it returns data for all nodes in the cluster? It technically takes a node parameter, but that is ignored by the handler (both before and after this series). What do you think?