[pve-devel] [PATCH-SERIES pve-http-server/pve-manager] fix#4689: rewrite_uri: autofind nodename for qemu/lxc

DERUMIER, Alexandre alexandre.derumier at groupe-cyllene.com
Wed May 31 16:05:56 CEST 2023

> hi, while this can work, it introduces a very specific rewriting into
> the
> http server, which might not be obvious and AFAICT won't show up in
> the
> auto-generated api docs?
yes, indeed, it doesnt show up in the doc.

> wouldn't it be better to have some api calls defined for real
> (the ones used most often for example) that make use of the
> proxyto_callback method instead?
I'm quoting Fabian from bugzilla:
Fabian Grünbichler 2023-04-24 13:48:07 CEST
yeah, some parts of the machinery are already in place, e.g., it's
possible to define a "proxyto_callback" that gets called instead of
resolving proxyto straight via the parameter. AFAICT that is not used
anywhere though ;)

probably it would mean caching the vmlist in each http server worker to
avoid expensive queries, plus implementing filtering of the vmid list
for the requesting user/token since we'd not want to leak existence or
location of guests that the user doesn't have access to.

So, it seem that Fabian have same opinion than you.

I was doing a simply rewrite to keep it simple, but
I'll have a look at proxyto_callback.

(BTW, vmlist don't seem to be so slow, i'm around 10 extra ms. I don't
think it need to be cached.  (it's still faster than doing 1
cluster/ressource api call to find the node + the final call).

> that way they would at least show up in the api documentation,
> even though it's probably a bit of code duplication
> (altough we could maybe just insert the api at a different place
> and do some perl magic refactoring to have it once
> with node parameter and once without?)
> or does that seem like a bad idea?

More information about the pve-devel mailing list