public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH common/storage/widget-toolkit v3] add tar.zst download in pve
@ 2023-10-19  9:13 Dominik Csapak
  2023-10-19  9:13 ` [pve-devel] [PATCH common v3 1/1] PBSClient: add 'tar' parameter to file_restore_extract Dominik Csapak
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Dominik Csapak @ 2023-10-19  9:13 UTC (permalink / raw)
  To: pve-devel

like we have the tar.zst download button for pbs itself, add it for
pve for both vms and container file-restore

pve-storage depends on pve-common

changes from v2:
* rebase on master
* drop applied patches

changes from v1:
* split format into 'format' and 'zstd'
* also use those parameters for file-restore
  (keep 'tar' for the pve api for gui compatibility)
* use an '#[api]'  enum for the format type

pve-common:

Dominik Csapak (1):
  PBSClient: add 'tar' parameter to file_restore_extract

 src/PVE/PBSClient.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

pve-storage:

Dominik Csapak (1):
  api/filerestore: add 'tar' parameter to 'download' api

 src/PVE/API2/Storage/FileRestore.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

proxmox-widget-toolkit:

Dominik Csapak (1):
  window/FileBrowser: enable tar button by default

 src/window/FileBrowser.js | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

-- 
2.30.2





^ permalink raw reply	[flat|nested] 9+ messages in thread

* [pve-devel] [PATCH common v3 1/1] PBSClient: add 'tar' parameter to file_restore_extract
  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 ` Dominik Csapak
  2023-11-06 17:34   ` [pve-devel] applied: " Thomas Lamprecht
  2023-10-19  9:13 ` [pve-devel] [PATCH storage v3 1/1] api/filerestore: add 'tar' parameter to 'download' api Dominik Csapak
  2023-10-19  9:13 ` [pve-devel] [PATCH widget-toolkit v3 1/1] window/FileBrowser: enable tar button by default Dominik Csapak
  2 siblings, 1 reply; 9+ messages in thread
From: Dominik Csapak @ 2023-10-19  9:13 UTC (permalink / raw)
  To: pve-devel

so that we can get a 'tar.zst' from proxmox-file-restore by giving
'--format tar --zstd' to the file-restore binary

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/PVE/PBSClient.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/PVE/PBSClient.pm b/src/PVE/PBSClient.pm
index ec05a1c..e63af03 100644
--- a/src/PVE/PBSClient.pm
+++ b/src/PVE/PBSClient.pm
@@ -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,
-- 
2.30.2





^ permalink raw reply	[flat|nested] 9+ messages in thread

* [pve-devel] [PATCH storage v3 1/1] api/filerestore: add 'tar' parameter to 'download' api
  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-10-19  9:13 ` Dominik Csapak
  2023-11-13 15:45   ` [pve-devel] applied: " Thomas Lamprecht
  2023-10-19  9:13 ` [pve-devel] [PATCH widget-toolkit v3 1/1] window/FileBrowser: enable tar button by default Dominik Csapak
  2 siblings, 1 reply; 9+ messages in thread
From: Dominik Csapak @ 2023-10-19  9:13 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* [pve-devel] [PATCH widget-toolkit v3 1/1] window/FileBrowser: enable tar button by default
  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-10-19  9:13 ` [pve-devel] [PATCH storage v3 1/1] api/filerestore: add 'tar' parameter to 'download' api Dominik Csapak
@ 2023-10-19  9:13 ` Dominik Csapak
  2023-11-13 15:46   ` [pve-devel] applied: " Thomas Lamprecht
  2023-11-13 15:46   ` [pve-devel] " Thomas Lamprecht
  2 siblings, 2 replies; 9+ messages in thread
From: Dominik Csapak @ 2023-10-19  9:13 UTC (permalink / raw)
  To: pve-devel

all endpoints now can handle the 'tar' parameter, so add it for all

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/window/FileBrowser.js | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/window/FileBrowser.js b/src/window/FileBrowser.js
index 4e4c639..e036d9f 100644
--- a/src/window/FileBrowser.js
+++ b/src/window/FileBrowser.js
@@ -61,10 +61,6 @@ Ext.define("Proxmox.window.FileBrowser", {
 	    'd': true, // directories
 	},
 
-	// enable tar download, this will add a menu to the "Download" button when the selection
-	// can be downloaded as `.tar` files
-	enableTar: false,
-
 	// prefix to prepend to downloaded file names
 	downloadPrefix: '',
     },
@@ -126,7 +122,7 @@ Ext.define("Proxmox.window.FileBrowser", {
 	    view.lookup('selectText').setText(st);
 
 	    let canDownload = view.downloadURL && view.downloadableFileTypes[data.type];
-	    let enableMenu = view.enableTar && data.type === 'd';
+	    let enableMenu = data.type === 'd';
 
 	    let downloadBtn = view.lookup('downloadBtn');
 	    downloadBtn.setDisabled(!canDownload || enableMenu);
-- 
2.30.2





^ permalink raw reply	[flat|nested] 9+ messages in thread

* [pve-devel] applied: [PATCH common v3 1/1] PBSClient: add 'tar' parameter to file_restore_extract
  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   ` Thomas Lamprecht
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Lamprecht @ 2023-11-06 17:34 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 19/10/2023 um 11:13 schrieb Dominik Csapak:
> so that we can get a 'tar.zst' from proxmox-file-restore by giving
> '--format tar --zstd' to the file-restore binary
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  src/PVE/PBSClient.pm | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
>

applied this one, thanks!




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [pve-devel] applied: [PATCH storage v3 1/1] api/filerestore: add 'tar' parameter to 'download' api
  2023-10-19  9:13 ` [pve-devel] [PATCH storage v3 1/1] api/filerestore: add 'tar' parameter to 'download' api Dominik Csapak
@ 2023-11-13 15:45   ` Thomas Lamprecht
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Lamprecht @ 2023-11-13 15:45 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 19/10/2023 um 11:13 schrieb Dominik Csapak:
> 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(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [pve-devel] applied: [PATCH widget-toolkit v3 1/1] window/FileBrowser: enable tar button by default
  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   ` Thomas Lamprecht
  2023-11-13 15:46   ` [pve-devel] " Thomas Lamprecht
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Lamprecht @ 2023-11-13 15:46 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 19/10/2023 um 11:13 schrieb Dominik Csapak:
> all endpoints now can handle the 'tar' parameter, so add it for all
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  src/window/FileBrowser.js | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [pve-devel] [PATCH widget-toolkit v3 1/1] window/FileBrowser: enable tar button by default
  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   ` Thomas Lamprecht
  2023-11-13 15:48     ` Dominik Csapak
  1 sibling, 1 reply; 9+ messages in thread
From: Thomas Lamprecht @ 2023-11-13 15:46 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

Am 19/10/2023 um 11:13 schrieb Dominik Csapak:
> diff --git a/src/window/FileBrowser.js b/src/window/FileBrowser.js
> index 4e4c639..e036d9f 100644
> --- a/src/window/FileBrowser.js
> +++ b/src/window/FileBrowser.js
> @@ -61,10 +61,6 @@ Ext.define("Proxmox.window.FileBrowser", {
>  	    'd': true, // directories
>  	},
>  
> -	// enable tar download, this will add a menu to the "Download" button when the selection
> -	// can be downloaded as `.tar` files
> -	enableTar: false,
> -

ps. isn't there a call-site where we had this set, i.e., that could be dropped now?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [pve-devel] [PATCH widget-toolkit v3 1/1] window/FileBrowser: enable tar button by default
  2023-11-13 15:46   ` [pve-devel] " Thomas Lamprecht
@ 2023-11-13 15:48     ` Dominik Csapak
  0 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2023-11-13 15:48 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox VE development discussion

On 11/13/23 16:46, Thomas Lamprecht wrote:
> Am 19/10/2023 um 11:13 schrieb Dominik Csapak:
>> diff --git a/src/window/FileBrowser.js b/src/window/FileBrowser.js
>> index 4e4c639..e036d9f 100644
>> --- a/src/window/FileBrowser.js
>> +++ b/src/window/FileBrowser.js
>> @@ -61,10 +61,6 @@ Ext.define("Proxmox.window.FileBrowser", {
>>   	    'd': true, // directories
>>   	},
>>   
>> -	// enable tar download, this will add a menu to the "Download" button when the selection
>> -	// can be downloaded as `.tar` files
>> -	enableTar: false,
>> -
> 
> ps. isn't there a call-site where we had this set, i.e., that could be dropped now?
> 

yes, but that's in proxmox-backup, should i already send that patch
or do we  wait until we bump widget-toolkit?




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-11-13 15:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [pve-devel] [PATCH storage v3 1/1] api/filerestore: add 'tar' parameter to 'download' api Dominik Csapak
2023-11-13 15:45   ` [pve-devel] applied: " 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

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