diff --git a/src/PVE/GuestImport/OVF.pm b/src/PVE/GuestImport/OVF.pm index 7dc4b24..1fae69b 100644 --- a/src/PVE/GuestImport/OVF.pm +++ b/src/PVE/GuestImport/OVF.pm @@ -354,7 +354,7 @@ ovf:Item[rasd:InstanceID='%s']/rasd:ResourceType", $controller_id); } if (!$isOva) { - my $size = PVE::Storage::file_size_info($backing_file_path); + my $size = PVE::Storage::file_size_info($backing_file_path, undef, 'auto-detect'); die "error parsing $backing_file_path, cannot determine file size\n" if !$size; diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm index c8e1f2a..df8e948 100755 --- a/src/PVE/Storage.pm +++ b/src/PVE/Storage.pm @@ -2223,7 +2223,7 @@ sub assert_iso_content { my ($path) = @_; # check for things like backing image - file_size_info($path, undef, undef, 1); + file_size_info($path, undef, 'auto-detect', 1); return 1; } diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm index 1f9156f..917bd61 100644 --- a/src/PVE/Storage/Plugin.pm +++ b/src/PVE/Storage/Plugin.pm @@ -959,10 +959,15 @@ my @checked_qemu_img_formats = qw(raw cow qcow qcow2 qed vmdk cloop); # - backing files (qcow2/vmdk) # - external data files (qcow2) # -# Set $file_format to force qemu-img to treat the image as being a specific format. +# Set $file_format to force qemu-img to treat the image as being a specific format. Use the value +# 'auto-detect' for auto-detection. The parameter is planned to become mandatory with Proxmox VE 9. sub file_size_info { my ($filename, $timeout, $file_format, $untrusted) = @_; + # TODO PVE 9 make $file_format mandatory + warn "file_size_info: detected call without \$file_format parameter\n" + if !defined($file_format); + # compat for old parameter order # TODO PVE 9 remove if (defined($file_format) && ($file_format eq '1' || $file_format eq '0')) { @@ -972,6 +977,8 @@ sub file_size_info { $file_format = undef; } + $file_format = undef if $file_format && $file_format eq 'auto-detect'; + my $st = File::stat::stat($filename); if (!defined($st)) {