mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-06 06:01:51 +00:00
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:
parent
9f3d73bc35
commit
e400f5e523
@ -5958,31 +5958,23 @@ sub restore_proxmox_backup_archive {
|
||||
my $volid = $d->{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 = [
|
||||
'/usr/bin/proxmox-backup-client',
|
||||
'restore',
|
||||
'/usr/bin/pbs-restore',
|
||||
'--repository', $repo,
|
||||
$pbs_backup_name,
|
||||
"$d->{devname}.img",
|
||||
'-',
|
||||
"$d->{devname}.img.fidx",
|
||||
$path,
|
||||
'--verbose',
|
||||
];
|
||||
|
||||
my $import_cmd = [
|
||||
'/usr/bin/qemu-img',
|
||||
'dd', '-n', '-f', 'raw', '-O', $d->{format}, 'bs=64K',
|
||||
'isize=0',
|
||||
"osize=$d->{size}",
|
||||
"of=$path",
|
||||
];
|
||||
if (PVE::Storage::volume_has_feature($storecfg, 'sparseinit', $volid)) {
|
||||
push @$pbs_restore_cmd, '--skip-zero';
|
||||
}
|
||||
|
||||
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";
|
||||
run_command([$pbs_restore_cmd, $import_cmd]);
|
||||
run_command($pbs_restore_cmd);
|
||||
}
|
||||
|
||||
$fh->seek(0, 0) || die "seek failed - $!\n";
|
||||
|
Loading…
Reference in New Issue
Block a user