mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-08-09 11:44:32 +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 $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";
|
||||||
|
Loading…
Reference in New Issue
Block a user