From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 1524B9DC23 for ; Tue, 6 Jun 2023 10:39:17 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E7051316DB for ; Tue, 6 Jun 2023 10:39:16 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 6 Jun 2023 10:39:15 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 81E7448C5D for ; Tue, 6 Jun 2023 10:39:15 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Tue, 6 Jun 2023 10:39:07 +0200 Message-Id: <20230606083914.1400960-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.015 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH common/http/guest-common/qemu-server v2] schema/config array support 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: , X-List-Received-Date: Tue, 06 Jun 2023 08:39:17 -0000 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 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 | 26 +++++----- src/PVE/RESTHandler.pm | 61 ++++++++++++++++++---- 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