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/[email protected]/
> > https://lore.proxmox.com/pve-devel/[email protected]/
> > 
> > Originally-by: Stefan Reiter <[email protected]>
> > Signed-off-by: Arthur Bied-Charreton <[email protected]>
> > ---
> >  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?



Reply via email to