api/filerestore: add 'tar' parameter to 'download' api
to be able to download 'tar.zst' archives Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
c4f6c2ff7a
commit
96c579a262
@ -167,6 +167,12 @@ __PACKAGE__->register_method ({
|
|||||||
description => 'base64-path to the directory or file to download.',
|
description => 'base64-path to the directory or file to download.',
|
||||||
type => 'string',
|
type => 'string',
|
||||||
},
|
},
|
||||||
|
tar => {
|
||||||
|
description => "Download dirs as 'tar.zst' instead of 'zip'.",
|
||||||
|
type => 'boolean',
|
||||||
|
optional => 1,
|
||||||
|
default => 0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
returns => {
|
returns => {
|
||||||
@ -182,6 +188,7 @@ __PACKAGE__->register_method ({
|
|||||||
my $path = extract_param($param, 'filepath');
|
my $path = extract_param($param, 'filepath');
|
||||||
my $storeid = extract_param($param, 'storage');
|
my $storeid = extract_param($param, 'storage');
|
||||||
my $volid = $parse_volname_or_id->($storeid, $param->{volume});
|
my $volid = $parse_volname_or_id->($storeid, $param->{volume});
|
||||||
|
my $tar = extract_param($param, 'tar') // 0;
|
||||||
|
|
||||||
my $cfg = PVE::Storage::config();
|
my $cfg = PVE::Storage::config();
|
||||||
my $scfg = PVE::Storage::storage_config($cfg, $storeid);
|
my $scfg = PVE::Storage::storage_config($cfg, $storeid);
|
||||||
@ -199,7 +206,7 @@ __PACKAGE__->register_method ({
|
|||||||
$rpcenv->fork_worker('pbs-download', undef, $user, sub {
|
$rpcenv->fork_worker('pbs-download', undef, $user, sub {
|
||||||
my $name = decode_base64($path);
|
my $name = decode_base64($path);
|
||||||
print "Starting download of file: $name\n";
|
print "Starting download of file: $name\n";
|
||||||
$client->file_restore_extract($fifo, $snap, $path, 1);
|
$client->file_restore_extract($fifo, $snap, $path, 1, $tar);
|
||||||
});
|
});
|
||||||
|
|
||||||
my $ret = {
|
my $ret = {
|
||||||
|
|||||||
Reference in New Issue
Block a user