From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 1/3] storage: plugin: return 'raw' format when parsing non-image volumes
Date: Tue, 10 Dec 2024 12:19:28 +0100 [thread overview]
Message-ID: <20241210111930.358363-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20241210111930.358363-1-f.gruenbichler@proxmox.com>
since `volume_size_info` passes the parsed format to `file_size_info`, which
prints a warning if the format is undef before falling back to auto-detection,
and these should always be treated as raw files anyway.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
src/PVE/Storage/Plugin.pm | 10 +++++-----
src/test/parse_volname_test.pm | 22 +++++++++++++---------
2 files changed, 18 insertions(+), 14 deletions(-)
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index ae3c9dc..5875553 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -650,19 +650,19 @@ sub parse_volname {
my (undef, $format, $isBase) = parse_name_dir($name);
return ('images', $name, $vmid, undef, undef, $isBase, $format);
} elsif ($volname =~ m!^iso/([^/]+$PVE::Storage::ISO_EXT_RE_0)$!) {
- return ('iso', $1);
+ return ('iso', $1, undef, undef, undef, undef, 'raw');
} elsif ($volname =~ m!^vztmpl/([^/]+$PVE::Storage::VZTMPL_EXT_RE_1)$!) {
- return ('vztmpl', $1);
+ return ('vztmpl', $1, undef, undef, undef, undef, 'raw');
} elsif ($volname =~ m!^rootdir/(\d+)$!) {
return ('rootdir', $1, $1);
} elsif ($volname =~ m!^backup/([^/]+$PVE::Storage::BACKUP_EXT_RE_2)$!) {
my $fn = $1;
if ($fn =~ m/^vzdump-(openvz|lxc|qemu)-(\d+)-.+/) {
- return ('backup', $fn, $2);
+ return ('backup', $fn, $2, undef, undef, undef, 'raw');
}
- return ('backup', $fn);
+ return ('backup', $fn, undef, undef, undef, undef, 'raw');
} elsif ($volname =~ m!^snippets/([^/]+)$!) {
- return ('snippets', $1);
+ return ('snippets', $1, undef, undef, undef, undef, 'raw');
} elsif ($volname =~ m!^import/(${PVE::Storage::SAFE_CHAR_WITH_WHITESPACE_CLASS_RE}+\.ova\/${PVE::Storage::OVA_CONTENT_RE_1})$!) {
my $packed_image = $1;
my $format = $2;
diff --git a/src/test/parse_volname_test.pm b/src/test/parse_volname_test.pm
index 2739cf1..175500d 100644
--- a/src/test/parse_volname_test.pm
+++ b/src/test/parse_volname_test.pm
@@ -29,12 +29,12 @@ my $tests = [
{
description => 'ISO image, iso',
volname => 'iso/some-installation-disk.iso',
- expected => ['iso', 'some-installation-disk.iso'],
+ expected => ['iso', 'some-installation-disk.iso', undef, undef, undef, undef, 'raw'],
},
{
description => 'ISO image, img',
volname => 'iso/some-other-installation-disk.img',
- expected => ['iso', 'some-other-installation-disk.img'],
+ expected => ['iso', 'some-other-installation-disk.img', undef, undef, undef, undef, 'raw'],
},
#
# container templates
@@ -42,17 +42,17 @@ my $tests = [
{
description => 'Container template tar.gz',
volname => 'vztmpl/debian-10.0-standard_10.0-1_amd64.tar.gz',
- expected => ['vztmpl', 'debian-10.0-standard_10.0-1_amd64.tar.gz'],
+ expected => ['vztmpl', 'debian-10.0-standard_10.0-1_amd64.tar.gz', undef, undef, undef, undef, 'raw'],
},
{
description => 'Container template tar.xz',
volname => 'vztmpl/debian-10.0-standard_10.0-1_amd64.tar.xz',
- expected => ['vztmpl', 'debian-10.0-standard_10.0-1_amd64.tar.xz'],
+ expected => ['vztmpl', 'debian-10.0-standard_10.0-1_amd64.tar.xz', undef, undef, undef, undef, 'raw'],
},
{
description => 'Container template tar.bz2',
volname => 'vztmpl/debian-10.0-standard_10.0-1_amd64.tar.bz2',
- expected => ['vztmpl', 'debian-10.0-standard_10.0-1_amd64.tar.bz2'],
+ expected => ['vztmpl', 'debian-10.0-standard_10.0-1_amd64.tar.bz2', undef, undef, undef, undef, 'raw'],
},
#
# container rootdir
@@ -70,7 +70,7 @@ my $tests = [
{
description => 'Backup archive, no virtualization type',
volname => "backup/vzdump-none-$vmid-2020_03_30-21_39_30.tar",
- expected => ['backup', "vzdump-none-$vmid-2020_03_30-21_39_30.tar"],
+ expected => ['backup', "vzdump-none-$vmid-2020_03_30-21_39_30.tar", undef, undef, undef, undef, 'raw'],
},
#
# Snippets
@@ -78,12 +78,12 @@ my $tests = [
{
description => 'Snippets, yaml',
volname => 'snippets/userconfig.yaml',
- expected => ['snippets', 'userconfig.yaml'],
+ expected => ['snippets', 'userconfig.yaml', undef, undef, undef, undef, 'raw'],
},
{
description => 'Snippets, perl',
volname => 'snippets/hookscript.pl',
- expected => ['snippets', 'hookscript.pl'],
+ expected => ['snippets', 'hookscript.pl', undef, undef, undef, undef, 'raw'],
},
#
# Import
@@ -229,7 +229,11 @@ foreach my $virt (keys %$bkp_suffix) {
expected => [
'backup',
"vzdump-$virt-$vmid-2020_03_30-21_12_40.$s",
- "$vmid"
+ "$vmid",
+ undef,
+ undef,
+ undef,
+ 'raw'
],
},
);
--
2.39.5
_______________________________________________
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:[~2024-12-10 11:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 11:19 [pve-devel] [PATCH storage 0/3] file_size_info follow-ups Fabian Grünbichler
2024-12-10 11:19 ` Fabian Grünbichler [this message]
2024-12-10 11:19 ` [pve-devel] [PATCH storage 2/3] esxi: fix return value of volume_size_info for vmx volumes Fabian Grünbichler
2024-12-10 11:56 ` Fiona Ebner
2024-12-10 11:19 ` [pve-devel] [RFC storage 3/3] storage: plugin: volume_size_info: fallback to raw for non-image volumes 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=20241210111930.358363-2-f.gruenbichler@proxmox.com \
--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