[pve-devel] [PATCH storage v2 3/3] file_size_info: add warning when falling back to raw format

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Dec 10 13:17:57 CET 2024


in case this gets called with an explicit format that is none of:
- 'auto-detect'
- 'subvol'
- a member of the list of known "qemu" formats

this should only affect third-party storage plugins that either call this
directly with a format, or via inherited code that gets a format from
parse_volname and passes it to file_size_info.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
v2: new, replacing old patch #3

 src/PVE/Storage/Plugin.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 5875553..6ee6938 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -1012,8 +1012,10 @@ sub file_size_info {
 
     # TODO PVE 9 - consider upgrading to "die" if an unsupported format is passed in after
     # evaluating breakage potential.
-    $file_format = 'raw' if $file_format && !grep { $_ eq $file_format } @checked_qemu_img_formats;
-
+    if ($file_format && !grep { $_ eq $file_format } @checked_qemu_img_formats) {
+	warn "file_size_info: '$filename': falling back to 'raw' from unknown format '$file_format'\n";
+	$file_format = 'raw';
+    }
     my $cmd = ['/usr/bin/qemu-img', 'info', '--output=json', $filename];
     push $cmd->@*, '-f', $file_format if $file_format;
 
-- 
2.39.5





More information about the pve-devel mailing list