5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2024-12-22 13:34:16 +03:00

file_size_info: add warning when falling back to raw format

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>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2024-12-10 13:13:42 +01:00
parent 081ce2c9df
commit a9e0f50d4a

View File

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