[pve-devel] [PATCH qemu-server] fix #2857: restore: pass keyfile to pbs-restore

Fabian Grünbichler f.gruenbichler at proxmox.com
Mon Jul 20 10:26:21 CEST 2020


if configured. otherwise restoring encrypted backups will be quite
hard..

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
Note: for restore to actually work, we need pbs-restore linked with a
bumped libproxmox-backup-qemu which has all the recent changes w.r.t.
encryption. we might want to bump pve-qemu-kvm as well to encode these
breaking changes in package relations, or add a libproxmox-backup-qemu
dependency in qemu-server?

 PVE/QemuServer.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 809124c..0a09f3a 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5937,6 +5937,7 @@ sub restore_proxmox_backup_archive {
     my $datastore = $scfg->{datastore};
     my $username = $scfg->{username} // 'root at pam';
     my $fingerprint = $scfg->{fingerprint};
+    my $keyfile = PVE::Storage::PBSPlugin::pbs_encryption_key_file_name($storecfg, $storeid);
 
     my $repo = "$username\@$server:$datastore";
 
@@ -6054,6 +6055,7 @@ sub restore_proxmox_backup_archive {
 		];
 
 	    push @$pbs_restore_cmd, '--format', $d->{format} if $d->{format};
+	    push @$pbs_restore_cmd, '--keyfile', $keyfile if -e $keyfile;
 
 	    if (PVE::Storage::volume_has_feature($storecfg, 'sparseinit', $volid)) {
 		push @$pbs_restore_cmd, '--skip-zero';
-- 
2.20.1






More information about the pve-devel mailing list