backup: detect PBS features and use only supported

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>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Stefan Reiter 2020-07-08 11:57:54 +02:00 committed by Thomas Lamprecht
parent b6f8076eb6
commit fb9f512c19

View File

@ -443,6 +443,12 @@ sub archive_pbs {
die "interrupted by signal\n"; die "interrupted by signal\n";
}; };
my $qemu_support = eval { mon_cmd($vmid, "query-proxmox-support") };
if (!$qemu_support) {
die "PBS backups are not supported by the running 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 $fs_frozen = $self->qga_fs_freeze($task, $vmid);
my $params = { my $params = {
@ -453,11 +459,12 @@ sub archive_pbs {
password => $password, password => $password,
devlist => $devlist, devlist => $devlist,
'config-file' => $conffile, 'config-file' => $conffile,
'use-dirty-bitmap' => JSON::true,
}; };
$params->{fingerprint} = $fingerprint if defined($fingerprint); $params->{fingerprint} = $fingerprint if defined($fingerprint);
$params->{'firewall-file'} = $firewall if -e $firewall; $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 $params->{timeout} = 60; # give some time to connect to the backup server
my $res = eval { mon_cmd($vmid, "backup", %$params) }; my $res = eval { mon_cmd($vmid, "backup", %$params) };