5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-03-11 16:58:28 +03:00

list images: return 'invalid' format value for image that cannot be queried in expected format

The only (transitive) caller that seems to be interested in the format
is the API endpoint for content listing.

The warning about not being able to query in the expected format might
not be seen by consumers that only use the API result, so this helps
admins detect such images. It is also for future-proofing, should any
new callers want to use only images of certain formats to error out
early.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner 2024-12-06 17:25:28 +01:00 committed by Fabian Grünbichler
parent 936fbe3f35
commit 541064a95b
2 changed files with 2 additions and 0 deletions

View File

@ -678,6 +678,7 @@ sub list_images {
warn "image '$fn' is not in expected format '$format', querying as raw\n";
($size, undef, $used, $parent, $ctime) =
PVE::Storage::Plugin::file_size_info($fn, undef, 'raw');
$format = 'invalid';
}
}
next if !defined($size);

View File

@ -1300,6 +1300,7 @@ sub list_images {
die $err if $err !~ m/Image is not in \S+ format$/;
warn "image '$fn' is not in expected format '$format', querying as raw\n";
($size, undef, $used, $parent, $ctime) = file_size_info($fn, undef, 'raw');
$format = 'invalid';
}
next if !defined($size);