From f1ea2c5c8991e2321bdc6979d28cbdee7950b92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Mon, 9 Dec 2024 11:48:01 +0100 Subject: [PATCH] file_size_info: add missing `format` parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit these calls would print spurious warnings otherwise. Signed-off-by: Fabian Grünbichler --- src/PVE/GuestImport.pm | 4 +++- src/PVE/Storage.pm | 2 +- src/PVE/Storage/ESXiPlugin.pm | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/PVE/GuestImport.pm b/src/PVE/GuestImport.pm index f7034cd..16099ca 100644 --- a/src/PVE/GuestImport.pm +++ b/src/PVE/GuestImport.pm @@ -36,6 +36,8 @@ sub extract_disk_from_import_file { die "cannot extract $volid - invalid volname $volname\n"; } + die "cannot determine format of '$volid'\n" if !$inner_fmt; + my $ova_path = PVE::Storage::path($cfg, $archive_volid); my $tmpdir = PVE::Storage::get_image_dir($cfg, $target_storeid, $vmid); @@ -63,7 +65,7 @@ sub extract_disk_from_import_file { } # check potentially untrusted image file! - PVE::Storage::file_size_info($source_path, undef, undef, 1); + PVE::Storage::file_size_info($source_path, undef, $inner_fmt, 1); # create temporary 1M image that will get overwritten by the rename # to reserve the filename and take care of locking diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm index df8e948..3b4f041 100755 --- a/src/PVE/Storage.pm +++ b/src/PVE/Storage.pm @@ -300,7 +300,7 @@ sub volume_size_info { my $plugin = PVE::Storage::Plugin->lookup($scfg->{type}); return $plugin->volume_size_info($scfg, $storeid, $volname, $timeout); } elsif ($volid =~ m|^(/.+)$| && -e $volid) { - return file_size_info($volid, $timeout); + return file_size_info($volid, $timeout, 'auto-detect'); } else { return 0; } diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm index 6e54bb0..ae10511 100644 --- a/src/PVE/Storage/ESXiPlugin.pm +++ b/src/PVE/Storage/ESXiPlugin.pm @@ -538,7 +538,7 @@ sub volume_size_info { return 0 if $volname =~ /\.vmx$/; my $filename = $class->path($scfg, $volname, $storeid, undef); - return PVE::Storage::Plugin::file_size_info($filename, $timeout); + return PVE::Storage::Plugin::file_size_info($filename, $timeout, 'auto-detect'); } sub volume_snapshot {