public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 1/1] vzdump: set max-workers QMP option when specified and supported
Date: Mon,  3 Oct 2022 15:52:06 +0200	[thread overview]
Message-ID: <20221003135211.183340-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20221003135211.183340-1-f.ebner@proxmox.com>

If not supported, a warning is printed and the setting is ignored.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
 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





  parent reply	other threads:[~2022-10-03 13:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-03 13:52 [pve-devel] [PATCH-SERIES qemu(-server)/guest-common/manager/docs] make QEMU's max-workers setting configurable as a vzdump setting Fiona Ebner
2022-10-03 13:52 ` [pve-devel] [PATCH qemu 1/1] PVE Backup: allow passing max-workers performance setting Fiona Ebner
2022-10-10 10:54   ` [pve-devel] applied: " Wolfgang Bumiller
2022-10-03 13:52 ` [pve-devel] [PATCH guest-common 1/1] vzdump: add 'performance' property string as a setting Fiona Ebner
2022-10-03 13:52 ` Fiona Ebner [this message]
2022-10-03 13:52 ` [pve-devel] [PATCH manager 1/1] vzdump: handle new 'performance' property string Fiona Ebner
2022-10-03 13:52 ` [pve-devel] [PATCH docs 1/4] backup: rework storage section, mentioning and recommending PBS Fiona Ebner
2022-10-03 13:52 ` [pve-devel] [PATCH docs 2/4] backup: expand section for jobs Fiona Ebner
2022-10-03 13:52 ` [pve-devel] [PATCH docs 3/4] backup: merge sections describing jobs Fiona Ebner
2022-10-03 13:52 ` [pve-devel] [PATCH docs 4/4] backup: mention max-workers performance setting Fiona Ebner
2022-10-10 11:10 ` [pve-devel] applied-series: [PATCH-SERIES qemu(-server)/guest-common/manager/docs] make QEMU's max-workers setting configurable as a vzdump setting Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221003135211.183340-4-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal