public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Reiter <s.reiter@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 qemu-server 2/2] backup: detect PBS features and use only supported
Date: Wed,  8 Jul 2020 11:35:57 +0200	[thread overview]
Message-ID: <20200708093557.12734-2-s.reiter@proxmox.com> (raw)
In-Reply-To: <20200708093557.12734-1-s.reiter@proxmox.com>

If 'query-proxmox-support' is not known to QEMU, assume that no other
features are supported either.

If 'pbs' is not supported at all, error out with a nice message.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---

v2:
* check for 'pbs' feature and error with nice message

 PVE/VZDump/QemuServer.pm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index 567088c..eb931c0 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -443,6 +443,12 @@ sub archive_pbs {
 	    die "interrupted by signal\n";
 	};
 
+	my $qemu_support = eval { mon_cmd($vmid, "query-proxmox-support") } // {};
+	if (!$qemu_support->{pbs}) {
+	    die "PBS backups are not supported by this QEMU version. Please make "
+		"sure you've installed the latest version and the VM has been restarted.\n";
+	}
+
 	my $fs_frozen = $self->qga_fs_freeze($task, $vmid);
 
 	my $params = {
@@ -453,11 +459,13 @@ sub archive_pbs {
 	    password => $password,
 	    devlist => $devlist,
 	    'config-file' => $conffile,
-	    'use-dirty-bitmap' => JSON::true,
 	};
 	$params->{fingerprint} = $fingerprint if defined($fingerprint);
 	$params->{'firewall-file'} = $firewall if -e $firewall;
 
+	$params->{'use-dirty-bitmap'} = JSON::true
+	    if $qemu_support->{'pbs-dirty-bitmap'};
+
 	$params->{timeout} = 60; # give some time to connect to the backup server
 
 	my $res = eval { mon_cmd($vmid, "backup", %$params) };
-- 
2.20.1





      reply	other threads:[~2020-07-08  9:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-08  9:35 [pve-devel] [PATCH v2 qemu 1/2] PVE: add query_proxmox_support QMP command Stefan Reiter
2020-07-08  9:35 ` Stefan Reiter [this message]

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=20200708093557.12734-2-s.reiter@proxmox.com \
    --to=s.reiter@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