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

plugin: create base: specify format when querying file info

By passing in the format, qemu-img will also check that the file is a
valid instance of the expected format instead of auto-detecting. The
size will also be correct when there previously was a wrong
auto-detection, but it is already only used for checking that the call
was successful.

It looks like this could also avoid wrongly failing checks with the
parent information, but a raw image cannot have a base volume and raw
images are those where the auto-detection might lead to a different
format.

Remove the unused variable $used while at it.

The check for $format in the result became obsolete with 35533c6 ("add
subvol support for directory storage").

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner 2024-12-06 17:25:24 +01:00 committed by Fabian Grünbichler
parent adfd7e9166
commit c29152c691

View File

@ -742,8 +742,8 @@ sub create_base {
my $path = $class->filesystem_path($scfg, $volname);
my ($size, undef, $used, $parent) = file_size_info($path);
die "file_size_info on '$volname' failed\n" if !($format && defined($size));
my ($size, undef, undef, $parent) = file_size_info($path, undef, $format);
die "file_size_info on '$volname' failed\n" if !defined($size);
die "volname '$volname' contains wrong information about parent\n"
if $basename && (!$parent || $parent ne "../$basevmid/$basename");