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 BF9581FF1BB for ; Fri, 5 Dec 2025 10:15:47 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id B3BB311E5A; Fri, 5 Dec 2025 10:16:12 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Fri, 5 Dec 2025 10:14:33 +0100 Message-ID: <20251205091539.783566-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 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 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [guest.pm, nodes.pm, proxmox.com] Subject: [pve-devel] [PATCH manager] api: workaround non-working 'maxworkers' alias in bulk actions api calls 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" It seems, that 'alias' schema does not properly work currently for normal schema definitions (only for property-string), since it does not verification of the actual schema (verified by calling the api with maxworkers=1000, which throws no errors). Luckily, this is the only use as api parameters that I could find, and here it did not do anything, since we did not actually use `$param->{maxworkers}` anymore. In the long term, we should fix it in JSONSchema, but as a stop-gap, restore the old 'maxworkers' parameters to a 'real' property and mark it deprecated. Also actually use it in the code and fix the error message to the new variant. Reported in the forums for the node-specific one (since there the gui uses still the old variant): https://forum.proxmox.com/threads/bulk-migrate-error-in-9-1-2.177326/ Signed-off-by: Dominik Csapak --- PVE/API2/Cluster/BulkAction/Guest.pm | 33 ++++++++++++++++++++++++---- PVE/API2/Nodes.pm | 14 ++++++++---- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/PVE/API2/Cluster/BulkAction/Guest.pm b/PVE/API2/Cluster/BulkAction/Guest.pm index 3a53ca60..9ed7dbb6 100644 --- a/PVE/API2/Cluster/BulkAction/Guest.pm +++ b/PVE/API2/Cluster/BulkAction/Guest.pm @@ -251,6 +251,7 @@ sub get_max_workers { my ($param, $default) = @_; return $param->{'max-workers'} if $param->{'max-workers'}; + return $param->{maxworkers} if $param->{maxworkers}; # alias my $datacenter_config = PVE::Cluster::cfs_read_file('datacenter.cfg'); return $datacenter_config->{max_workers} if $datacenter_config->{max_workers}; @@ -286,7 +287,13 @@ __PACKAGE__->register_method({ optional => 1, }, maxworkers => { - alias => 'max-workers', + description => "Defines the maximum number of tasks running concurrently." + . " Deprecated, use 'max-workers' instead.", + optional => 1, + default => 4, + type => 'integer', + minimum => 1, + maximum => 64, }, 'max-workers' => { description => "Defines the maximum number of tasks running concurrently.", @@ -422,7 +429,13 @@ __PACKAGE__->register_method({ optional => 1, }, maxworkers => { - alias => 'max-workers', + description => "Defines the maximum number of tasks running concurrently." + . " Deprecated, use 'max-workers' instead.", + optional => 1, + default => 4, + type => 'integer', + minimum => 1, + maximum => 64, }, 'max-workers' => { description => "Defines the maximum number of tasks running concurrently.", @@ -567,7 +580,13 @@ __PACKAGE__->register_method({ optional => 1, }, maxworkers => { - alias => 'max-workers', + description => "Defines the maximum number of tasks running concurrently." + . " Deprecated, use 'max-workers' instead.", + optional => 1, + default => 4, + type => 'integer', + minimum => 1, + maximum => 64, }, 'max-workers' => { description => "Defines the maximum number of tasks running concurrently.", @@ -704,7 +723,13 @@ __PACKAGE__->register_method({ optional => 1, }, maxworkers => { - alias => 'max-workers', + description => "Defines the maximum number of tasks running concurrently." + . " Deprecated, use 'max-workers' instead.", + optional => 1, + default => 4, + type => 'integer', + minimum => 1, + maximum => 64, }, 'max-workers' => { description => "Defines the maximum number of tasks running concurrently.", diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm index 3ca1c319..6a6465b6 100644 --- a/PVE/API2/Nodes.pm +++ b/PVE/API2/Nodes.pm @@ -2559,7 +2559,13 @@ __PACKAGE__->register_method({ node => get_standard_option('pve-node'), target => get_standard_option('pve-node', { description => "Target node." }), maxworkers => { - alias => 'max-workers', + description => "Maximal number of parallel migration job. If not set, uses" + . "'max_workers' from datacenter.cfg. One of both must be set!" + . "Deprecated, use 'max-workers' instead.", + optional => 1, + type => 'integer', + minimum => 1, + maximum => 64, }, 'max-workers' => { description => "Maximal number of parallel migration job. If not set, uses" @@ -2613,10 +2619,10 @@ __PACKAGE__->register_method({ my $datacenterconfig = cfs_read_file('datacenter.cfg'); # prefer parameter over datacenter cfg settings - my $max_workers = - $param->{'max-workers'} + my $max_workers = $param->{'max-workers'} + || $param->{'maxworkers'} # alias || $datacenterconfig->{max_workers} - || die "either 'maxworkers' parameter or max_workers in datacenter.cfg must be set!\n"; + || die "either 'max-workers' parameter or max_workers in datacenter.cfg must be set!\n"; my $code = sub { $rpcenv->{type} = 'priv'; # to start tasks in background -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel