From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH storage v4 1/2] fix #4849: download-url: allow download and decompression of compressed ISOs
Date: Fri, 04 Aug 2023 13:51:31 +0200 [thread overview]
Message-ID: <1691149799.sa9pjvko86.astroid@yuna.none> (raw)
In-Reply-To: <20230801144604.760331-2-p.hufnagl@proxmox.com>
On August 1, 2023 4:45 pm, Philipp Hufnagl wrote:
a bit of description here would be nice..
that being said,
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Tested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
can be applied with a corresponding bumped dep on libpve-common-perl
after that one has been released!
> Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
> ---
> src/PVE/API2/Storage/Status.pm | 14 +++++++++++++-
> src/PVE/Storage.pm | 6 ++++++
> src/PVE/Storage/Plugin.pm | 3 ++-
> 3 files changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/src/PVE/API2/Storage/Status.pm b/src/PVE/API2/Storage/Status.pm
> index 2aaeff6..7875530 100644
> --- a/src/PVE/API2/Storage/Status.pm
> +++ b/src/PVE/API2/Storage/Status.pm
> @@ -578,6 +578,12 @@ __PACKAGE__->register_method({
> requires => 'checksum-algorithm',
> optional => 1,
> },
> + compression => {
> + description => "Decompress the downloaded file using specified compression algorithm",
> + type => 'string',
> + enum => $PVE::Storage::Plugin::KNOWN_COMPRESSION_FORMATS,
> + optional => 1,
> + },
> 'checksum-algorithm' => {
> description => "The algorithm to calculate the checksum of the file.",
> type => 'string',
> @@ -604,7 +610,7 @@ __PACKAGE__->register_method({
>
> my $cfg = PVE::Storage::config();
>
> - my ($node, $storage) = $param->@{'node', 'storage'};
> + my ($node, $storage, $compression) = $param->@{'node', 'storage','compression'};
> my $scfg = PVE::Storage::storage_check_enabled($cfg, $storage, $node);
>
> die "can't upload to storage type '$scfg->{type}', not a file based storage!\n"
> @@ -649,6 +655,12 @@ __PACKAGE__->register_method({
> }
>
> my $worker = sub {
> + if ($compression) {
> + die "decompression not supported for $content\n" if $content ne 'iso';
> + my $info = PVE::Storage::decompressor_info('iso', $compression);
> + die "no decompression method found\n" if (! $info->{decompressor});
> + $opts->{decompression_command} = $info->{decompressor};
> + }
> PVE::Tools::download_file_from_url("$path/$filename", $url, $opts);
> };
>
> diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm
> index a4d85e1..cb70113 100755
> --- a/src/PVE/Storage.pm
> +++ b/src/PVE/Storage.pm
> @@ -1531,6 +1531,12 @@ sub decompressor_info {
> lzo => ['lzop', '-d', '-c'],
> zst => ['zstd', '-q', '-d', '-c'],
> },
> + iso => {
> + # zstd seem to be able to handle .gzip fine. Therefore we dont need additional other tool
> + gz => ['zcat'],
> + lzo => ['lzop', '-d', '-c'],
> + zst => ['zstd', '-q', '-d', '-c'],
> + },
> };
>
> die "ERROR: archive format not defined\n"
> diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
> index 9d3b1ae..18cb5d5 100644
> --- a/src/PVE/Storage/Plugin.pm
> +++ b/src/PVE/Storage/Plugin.pm
> @@ -19,7 +19,8 @@ use JSON;
>
> use base qw(PVE::SectionConfig);
>
> -use constant COMPRESSOR_RE => 'gz|lzo|zst';
> +use constant KNOWN_COMPRESSION_FORMATS => ( 'gz', 'lzo', 'zst');
> +use constant COMPRESSOR_RE => join( '|', KNOWN_COMPRESSION_FORMATS);
>
> use constant LOG_EXT => ".log";
> use constant NOTES_EXT => ".notes";
> --
> 2.39.2
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
next prev parent reply other threads:[~2023-08-04 11:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-01 14:45 [pve-devel] [PATCH storage/manager/common v4 0/6] fix #4849: allow download " Philipp Hufnagl
2023-08-01 14:45 ` [pve-devel] [PATCH storage v4 1/2] fix #4849: download-url: allow download and decompression " Philipp Hufnagl
2023-08-04 11:51 ` Fabian Grünbichler [this message]
2023-08-01 14:46 ` [pve-devel] [PATCH storage v4 2/2] fix whitespaces Philipp Hufnagl
2023-08-04 11:49 ` [pve-devel] applied: " Fabian Grünbichler
2023-08-01 14:46 ` [pve-devel] [PATCH common v4 1/2] fix #4849: download file from url: add opt parameter for a decompression command Philipp Hufnagl
2023-08-04 11:47 ` [pve-devel] applied: " Fabian Grünbichler
2023-08-01 14:46 ` [pve-devel] [PATCH common v4 2/2] fix whitespaces Philipp Hufnagl
2023-08-04 11:48 ` [pve-devel] applied: " Fabian Grünbichler
2023-08-01 14:46 ` [pve-devel] [PATCH manager v4 1/2] fix #4849: download to storage: automatically dectect and configure compression Philipp Hufnagl
2023-08-04 11:53 ` Fabian Grünbichler
2023-08-01 14:46 ` [pve-devel] [PATCH manager v4 2/2] fix whitespaces Philipp Hufnagl
2023-08-04 11:49 ` [pve-devel] applied: " Fabian Grünbichler
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=1691149799.sa9pjvko86.astroid@yuna.none \
--to=f.gruenbichler@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