[pve-devel] [PATCH v2 qemu-server 2/2] backup: detect PBS features and use only supported

Stefan Reiter s.reiter at proxmox.com
Wed Jul 8 11:35:57 CEST 2020


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 at 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






More information about the pve-devel mailing list