all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH common/http/guest-common/qemu-server v3] schema/config array support
@ 2023-06-06 13:08 Dominik Csapak
  2023-06-06 13:08 ` [pve-devel] [PATCH common v3 1/3] JSONSchema: add support for array parameter in api calls, cli and config Dominik Csapak
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: Dominik Csapak @ 2023-06-06 13:08 UTC (permalink / raw)
  To: pve-devel

and removal of the '-alist' format

This series aims to implement array support for the api and
(section)config and remove the support for the (rarely used) '-alist'
formats.

currently sending arrays over the api (by sending a parameter multiple
times with form-urlencoded) results in the api call getting a \0
separated string, which it must split with e.g. split_list.

Instead, we want to simply specify an 'array' type for the api.

We only ever used '-alist' in two places:
* 'exclude-path' config/parameter for vzdump
* 'command' parameter for qemu guest agent exec via api (cli has it's
  own implementation with 'extra-args')

additionally, we (incidentally?) allowed the same format for the regular
'-list' formats, and the gui makes heavy use of this (iow. sending
arrays which get converted to \0 byte separated strings)

so we also auto-convert in some circumstances (which we want to
deprecate in a future version)

changes from v2:
* renamed 'convert_param' sub
* made it properly recursive with 'use feature current_sub'
  (thanks wolfgang)
* style fixes according to thomas
* added wolfangs acked-by i missed last version

changes from v1:
* rebased on master
* incorporated feedback from wolfang
* added auto conversion of string <-> array in appropriate situations
* added tests for above
* omit applied manager patch

The dependcies/breaks are like this:

pve-http-server 1/2 is rather independent (did encounter this during
testing, and the current behaviour is imho wrong)

pve-guest-common depends on new (applied) pve-manager,
pve-http-server and pve-common 1/3

qemu-sever depends on pve-http-server and pve-common 1/3

pve-http-server does not technically break the older pve-guest-common
and qemu-server versions, but the parameters would need to be
encoded/sent differently than before (iow. the api user would have to
send the commands/paths \0 separated already instead of repeating the
parameters (form-urlencoded arrays))

pve-common 2/3 depend on all above

pve-common 3/3 depend on all above and it breaks every version that uses
an '-alist' format (so older pve-guest-common + qemu-server)

we can of course omit pve-common 3/3 and leave support in the
jsonschema, but imho it's really weird to use and has no real upsides
versus using simply an array type

pve-common:

Dominik Csapak (3):
  JSONSchema: add support for array parameter in api calls, cli and
    config
  section config: implement array support
  JSONSchema: disable '-alist' format

 src/PVE/JSONSchema.pm       |  25 ++++-----
 src/PVE/RESTHandler.pm      |  62 ++++++++++++++++++----
 src/PVE/SectionConfig.pm    |  42 +++++++++++++--
 test/Makefile               |   9 +++-
 test/api_parameter_test.pl  | 100 ++++++++++++++++++++++++++++++++++++
 test/section_config_test.pl |  26 ++++++++++
 6 files changed, 237 insertions(+), 27 deletions(-)
 create mode 100755 test/api_parameter_test.pl

pve-http-server:

Dominik Csapak (2):
  proxy request: forward json content type and parameters
  use proper arrays for array parameter

 src/PVE/APIServer/AnyEvent.pm | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

pve-guest-common:

Dominik Csapak (1):
  vzdump: change 'exclude-path' from alist to an array format

 src/PVE/VZDump/Common.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

qemu-server:

Dominik Csapak (1):
  api: switch agent api call to 'array' type

 PVE/API2/Qemu/Agent.pm | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

-- 
2.30.2





^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2023-06-07 12:32 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06 13:08 [pve-devel] [PATCH common/http/guest-common/qemu-server v3] schema/config array support Dominik Csapak
2023-06-06 13:08 ` [pve-devel] [PATCH common v3 1/3] JSONSchema: add support for array parameter in api calls, cli and config Dominik Csapak
2023-06-07 11:15   ` [pve-devel] applied: " Wolfgang Bumiller
2023-06-06 13:08 ` [pve-devel] [PATCH common v3 2/3] section config: implement array support Dominik Csapak
2023-06-06 13:08 ` [pve-devel] [PATCH common v3 3/3] JSONSchema: disable '-alist' format Dominik Csapak
2023-06-06 13:08 ` [pve-devel] [PATCH http-server v3 1/2] proxy request: forward json content type and parameters Dominik Csapak
2023-06-07 11:23   ` [pve-devel] applied: " Wolfgang Bumiller
2023-06-07 11:47     ` Thomas Lamprecht
2023-06-07 11:49       ` Dominik Csapak
2023-06-07 11:59         ` Thomas Lamprecht
2023-06-07 12:08           ` Wolfgang Bumiller
2023-06-07 12:14             ` Thomas Lamprecht
2023-06-07 12:23               ` Wolfgang Bumiller
2023-06-07 12:25                 ` Wolfgang Bumiller
2023-06-07 12:32                   ` Thomas Lamprecht
2023-06-06 13:08 ` [pve-devel] [PATCH http-server v3 2/2] use proper arrays for array parameter Dominik Csapak
2023-06-07  5:24   ` Dominik Csapak
2023-06-06 13:08 ` [pve-devel] [PATCH guest-common v3 1/1] vzdump: change 'exclude-path' from alist to an array format Dominik Csapak
2023-06-07 11:43   ` [pve-devel] applied: " Wolfgang Bumiller
2023-06-06 13:08 ` [pve-devel] [PATCH qemu-server v3 1/1] api: switch agent api call to 'array' type Dominik Csapak
2023-06-07 11:55   ` [pve-devel] applied: " Wolfgang Bumiller
2023-06-07 11:55 ` [pve-devel] applied-series: [PATCH common/http/guest-common/qemu-server v3] schema/config array support Wolfgang Bumiller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal