]> git.proxmox.com Git - pve-common.git/commitdiff
pbs client: add 'tar' parameter to file_restore_extract
authorDominik Csapak <d.csapak@proxmox.com>
Thu, 19 Oct 2023 09:13:53 +0000 (11:13 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 6 Nov 2023 17:33:38 +0000 (18:33 +0100)
so that we can get a 'tar.zst' from proxmox-file-restore by passing
'--format tar --zstd' to the file-restore binary

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/PBSClient.pm

index ec05a1cb70419c4e987cacc0c11145fedae98b5e..e63af03dfaa26f09a1f8735513eebd1f356665f8 100644 (file)
@@ -416,7 +416,7 @@ sub file_restore_extract_prepare {
 
 # this blocks while data is transfered, call this from a background worker
 sub file_restore_extract {
-    my ($self, $output_file, $snapshot, $filepath, $base64) = @_;
+    my ($self, $output_file, $snapshot, $filepath, $base64, $tar) = @_;
 
     (my $namespace, $snapshot) = split_namespaced_parameter($self, $snapshot);
 
@@ -430,10 +430,15 @@ sub file_restore_extract {
        my $fn = fileno($fh);
        my $errfunc = sub { print $_[0], "\n"; };
 
+       my $cmd = [ $snapshot, $filepath, "-", "--base64", $base64 ? 1 : 0];
+       if ($tar) {
+           push @$cmd, '--format', 'tar', '--zstd', 1;
+       }
+
        return run_raw_client_cmd(
            $self,
             "extract",
-           [ $snapshot, $filepath, "-", "--base64", $base64 ? 1 : 0 ],
+           $cmd,
            binary => "proxmox-file-restore",
            namespace => $namespace,
            errfunc => $errfunc,