From c29152c69172da009e678175cc7855d76cd8cefe Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Fri, 6 Dec 2024 17:25:24 +0100 Subject: [PATCH] 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 --- src/PVE/Storage/Plugin.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm index 11b0545..493c0e0 100644 --- a/src/PVE/Storage/Plugin.pm +++ b/src/PVE/Storage/Plugin.pm @@ -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");