mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2025-01-03 01:18:01 +03:00
plugin: list images: specify format when querying file info
This avoids auto-detection by qemu-img and so the information will be correct with respect to the actual image format on the storage layer. Should the image not be in the correct format, warn and try again querying as raw, so the image is still listed. The image is present, so it is better if it is listed and for some backwards compatibility. The format is still returned as the matched format in such a case, because that is how the image is treated, even if corrupt. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
c29152c691
commit
6e22cae004
@ -1282,11 +1282,19 @@ sub list_images {
|
||||
|
||||
my $owner = $2;
|
||||
my $name = $3;
|
||||
my $format = $4;
|
||||
|
||||
next if !$vollist && defined($vmid) && ($owner ne $vmid);
|
||||
|
||||
my ($size, $format, $used, $parent, $ctime) = file_size_info($fn);
|
||||
next if !($format && defined($size));
|
||||
my ($size, undef, $used, $parent, $ctime) = eval {
|
||||
file_size_info($fn, undef, $format);
|
||||
};
|
||||
if (my $err = $@) {
|
||||
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');
|
||||
}
|
||||
next if !defined($size);
|
||||
|
||||
my $volid;
|
||||
if ($parent && $parent =~ m!^../(\d+)/([^/]+\.($fmts))$!) {
|
||||
|
Loading…
Reference in New Issue
Block a user