public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage v2 3/3] file_size_info: add warning when falling back to raw format
Date: Tue, 10 Dec 2024 13:17:57 +0100	[thread overview]
Message-ID: <20241210121757.433869-4-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20241210121757.433869-1-f.gruenbichler@proxmox.com>

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@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



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

  parent reply	other threads:[~2024-12-10 12:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 12:17 [pve-devel] [PATCH storage v2 0/3] file_size_info follow-ups Fabian Grünbichler
2024-12-10 12:17 ` [pve-devel] [PATCH storage v2 1/3] storage: plugin: return 'raw' format when parsing non-image volumes Fabian Grünbichler
2024-12-10 12:17 ` [pve-devel] [PATCH storage v2 2/3] esxi: fix return value of volume_size_info for vmx volumes Fabian Grünbichler
2024-12-10 12:34   ` Fiona Ebner
2024-12-10 12:17 ` Fabian Grünbichler [this message]
2024-12-10 12:35 ` [pve-devel] [PATCH storage v2 0/3] file_size_info follow-ups Fiona Ebner
2024-12-10 13:35   ` [pve-devel] applied-series: " 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=20241210121757.433869-4-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal