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 E566992242 for ; Mon, 3 Oct 2022 15:52:17 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C967932228 for ; Mon, 3 Oct 2022 15:52:17 +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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 3 Oct 2022 15:52: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 E148244759 for ; Mon, 3 Oct 2022 15:52:14 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Mon, 3 Oct 2022 15:52:06 +0200 Message-Id: <20221003135211.183340-4-f.ebner@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221003135211.183340-1-f.ebner@proxmox.com> References: <20221003135211.183340-1-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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% 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 Subject: [pve-devel] [PATCH qemu-server 1/1] vzdump: set max-workers QMP option when specified and supported 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: Mon, 03 Oct 2022 13:52:17 -0000 If not supported, a warning is printed and the setting is ignored. Signed-off-by: Fiona Ebner --- PVE/VZDump/QemuServer.pm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm index bf0d1c56..7fb51c7d 100644 --- a/PVE/VZDump/QemuServer.pm +++ b/PVE/VZDump/QemuServer.pm @@ -15,6 +15,7 @@ use PVE::INotify; use PVE::IPCC; use PVE::JSONSchema; use PVE::PBSClient; +use PVE::RESTEnvironment qw(log_warn); use PVE::QMPClient; use PVE::Storage::Plugin; use PVE::Storage::PBSPlugin; @@ -453,6 +454,26 @@ my $detach_tpmstate_drive = sub { eval { PVE::QemuServer::qemu_drivedel($vmid, "tpmstate0-backup"); }; }; +my sub add_backup_performance_options { + my ($qmp_param, $perf, $qemu_support) = @_; + + return if !$perf || scalar(keys $perf->%*) == 0; + + if (!$qemu_support) { + my $settings_string = join(', ', sort keys $perf->%*); + log_warn("ignoring setting(s): $settings_string - issue checking if supported"); + return; + } + + if (defined($perf->{'max-workers'})) { + if ($qemu_support->{'backup-max-workers'}) { + $qmp_param->{'max-workers'} = int($perf->{'max-workers'}); + } else { + log_warn("ignoring 'max-workers' setting - not supported by running QEMU"); + } + } +} + sub archive_pbs { my ($self, $task, $vmid) = @_; @@ -548,7 +569,10 @@ sub archive_pbs { if (defined(my $ns = $scfg->{namespace})) { $params->{'backup-ns'} = $ns; } + $params->{speed} = $opts->{bwlimit}*1024 if $opts->{bwlimit}; + add_backup_performance_options($params, $opts->{performance}, $qemu_support); + $params->{fingerprint} = $fingerprint if defined($fingerprint); $params->{'firewall-file'} = $firewall if -e $firewall; if (-e $keyfile) { @@ -716,6 +740,11 @@ sub archive_vma { die "interrupted by signal\n"; }; + # Currently, failing to determine Proxmox support is not critical here, because it's only + # used for performance settings like 'max-workers'. + my $qemu_support = eval { mon_cmd($vmid, "query-proxmox-support") }; + log_warn($@) if $@; + $attach_tpmstate_drive->($self, $task, $vmid); my $outfh; @@ -746,6 +775,7 @@ sub archive_vma { devlist => $devlist }; $params->{'firewall-file'} = $firewall if -e $firewall; + add_backup_performance_options($params, $opts->{performance}, $qemu_support); $qmpclient->queue_cmd($vmid, $backup_cb, 'backup', %$params); }; -- 2.30.2