PVE/QemuServer.pm - proxmox backup server restore: use new pbs-restore binary

This is much faster than using a pipe with qemu-img.
This commit is contained in:
Dietmar Maurer 2020-03-11 07:55:56 +01:00 committed by Thomas Lamprecht
parent 9f3d73bc35
commit e400f5e523

View File

@ -5958,31 +5958,23 @@ sub restore_proxmox_backup_archive {
my $volid = $d->{volid}; my $volid = $d->{volid};
my $path = PVE::Storage::path($storecfg, $volid); my $path = PVE::Storage::path($storecfg, $volid);
if (PVE::Storage::volume_has_feature($storecfg, 'sparseinit', $volid)) {
#$path = "zeroinit:$path"; # fixme
}
my $pbs_restore_cmd = [ my $pbs_restore_cmd = [
'/usr/bin/proxmox-backup-client', '/usr/bin/pbs-restore',
'restore',
'--repository', $repo, '--repository', $repo,
$pbs_backup_name, $pbs_backup_name,
"$d->{devname}.img", "$d->{devname}.img.fidx",
'-', $path,
'--verbose', '--verbose',
]; ];
my $import_cmd = [ if (PVE::Storage::volume_has_feature($storecfg, 'sparseinit', $volid)) {
'/usr/bin/qemu-img', push @$pbs_restore_cmd, '--skip-zero';
'dd', '-n', '-f', 'raw', '-O', $d->{format}, 'bs=64K', }
'isize=0',
"osize=$d->{size}",
"of=$path",
];
my $dbg_cmdstring = PVE::Tools::cmd2string($pbs_restore_cmd) . '|' . PVE::Tools::cmd2string($import_cmd); my $dbg_cmdstring = PVE::Tools::cmd2string($pbs_restore_cmd);
print "restore proxmox backup image: $dbg_cmdstring\n"; print "restore proxmox backup image: $dbg_cmdstring\n";
run_command([$pbs_restore_cmd, $import_cmd]); run_command($pbs_restore_cmd);
} }
$fh->seek(0, 0) || die "seek failed - $!\n"; $fh->seek(0, 0) || die "seek failed - $!\n";