[pbs-devel] [RFC PATCH qemu-server 5/6] vzdump: Set protected flag on backup start if supported
Christoph Heiss
c.heiss at proxmox.com
Wed Jan 18 11:49:02 CET 2023
Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
PVE/VZDump/QemuServer.pm | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index 0eb5ec6..1d1131c 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -477,6 +477,13 @@ my sub add_backup_performance_options {
}
}
+my sub backup_client_supports_protected_flag {
+ my $supported;
+ PVE::Tools::run_command(['/usr/bin/proxmox-backup-client', 'help', 'backup'],
+ logfunc => sub { $supported = 1 if shift =~ m/--protected/ });
+ return $supported;
+}
+
sub archive_pbs {
my ($self, $task, $vmid) = @_;
@@ -515,6 +522,10 @@ sub archive_pbs {
push @$cmd, '--ns', $ns;
}
+ if ($opts->{protected} && backup_client_supports_protected_flag()) {
+ push @$cmd, '--protected', '1';
+ }
+
push @$cmd, "qemu-server.conf:$conffile";
push @$cmd, "fw.conf:$firewall" if -e $firewall;
@@ -603,6 +614,9 @@ sub archive_pbs {
$params->{'use-dirty-bitmap'} = JSON::true
if $qemu_support->{'pbs-dirty-bitmap'} && !$is_template;
+ $params->{'protected'} = JSON::true
+ if $qemu_support->{'pbs-protected-flag'} && $opts->{protected};
+
$params->{timeout} = 125; # give some time to connect to the backup server
my $res = eval { mon_cmd($vmid, "backup", %$params) };
--
2.34.1
More information about the pbs-devel
mailing list