public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage v3 1/1] api/filerestore: add 'tar' parameter to 'download' api
Date: Thu, 19 Oct 2023 11:13:54 +0200	[thread overview]
Message-ID: <20231019091355.2799960-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20231019091355.2799960-1-d.csapak@proxmox.com>

to be able to download 'tar.zst' archives

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/PVE/API2/Storage/FileRestore.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/Storage/FileRestore.pm b/src/PVE/API2/Storage/FileRestore.pm
index 764ebfb..6c9cda6 100644
--- a/src/PVE/API2/Storage/FileRestore.pm
+++ b/src/PVE/API2/Storage/FileRestore.pm
@@ -167,6 +167,12 @@ __PACKAGE__->register_method ({
 		description => 'base64-path to the directory or file to download.',
 		type => 'string',
 	    },
+	    tar => {
+		description => "Download dirs as 'tar.zst' instead of 'zip'.",
+		type => 'boolean',
+		optional => 1,
+		default => 0,
+	    },
 	},
     },
     returns => {
@@ -182,6 +188,7 @@ __PACKAGE__->register_method ({
 	my $path = extract_param($param, 'filepath');
 	my $storeid = extract_param($param, 'storage');
 	my $volid = $parse_volname_or_id->($storeid, $param->{volume});
+	my $tar = extract_param($param, 'tar') // 0;
 
 	my $cfg = PVE::Storage::config();
 	my $scfg = PVE::Storage::storage_config($cfg, $storeid);
@@ -199,7 +206,7 @@ __PACKAGE__->register_method ({
 	$rpcenv->fork_worker('pbs-download', undef, $user, sub {
 	    my $name = decode_base64($path);
 	    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 = {
-- 
2.30.2





  parent reply	other threads:[~2023-10-19  9:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19  9:13 [pve-devel] [PATCH common/storage/widget-toolkit v3] add tar.zst download in pve Dominik Csapak
2023-10-19  9:13 ` [pve-devel] [PATCH common v3 1/1] PBSClient: add 'tar' parameter to file_restore_extract Dominik Csapak
2023-11-06 17:34   ` [pve-devel] applied: " Thomas Lamprecht
2023-10-19  9:13 ` Dominik Csapak [this message]
2023-11-13 15:45   ` [pve-devel] applied: [PATCH storage v3 1/1] api/filerestore: add 'tar' parameter to 'download' api Thomas Lamprecht
2023-10-19  9:13 ` [pve-devel] [PATCH widget-toolkit v3 1/1] window/FileBrowser: enable tar button by default Dominik Csapak
2023-11-13 15:46   ` [pve-devel] applied: " Thomas Lamprecht
2023-11-13 15:46   ` [pve-devel] " Thomas Lamprecht
2023-11-13 15:48     ` Dominik Csapak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231019091355.2799960-3-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal