From c8ed1ac24ef915fb832ec1770ce252c72b730480 Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Fri, 6 Dec 2024 17:25:35 +0100 Subject: [PATCH] api: create disks: live import: use format from storage layer Avoid that file_size_info() does auto-detection via qemu-img. This also adapts to the new argument order. Signed-off-by: Fiona Ebner --- PVE/API2/Qemu.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 75c81eb9..6520cbea 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -438,9 +438,9 @@ my sub create_disks : prototype($$$$$$$$$$$) { my ($source_storage, $source_volid) = PVE::Storage::parse_volume_id($source, 1); if ($source_storage) { # PVE-managed volume - my ($vtype, undef, undef, undef, undef, undef, $fmt) - = PVE::Storage::parse_volname($storecfg, $source); - my $needs_extraction = PVE::QemuServer::Helpers::needs_extraction($vtype, $fmt); + my ($vtype, $source_format) = (checked_parse_volname($storecfg, $source))[0,6]; + my $needs_extraction = + PVE::QemuServer::Helpers::needs_extraction($vtype, $source_format); my $untrusted = $vtype eq 'import' ? 1 : 0; if ($needs_extraction) { print "extracting $source\n"; @@ -460,7 +460,7 @@ my sub create_disks : prototype($$$$$$$$$$$) { my $path = PVE::Storage::path($storecfg, $source) or die "failed to get a path for '$source'\n"; # check potentially untrusted image file for import vtype - ($size, my $source_format) = PVE::Storage::file_size_info($path, undef, $untrusted); + $size = PVE::Storage::file_size_info($path, undef, $source_format, $untrusted); die "could not get file size of $path\n" if !$size; $live_import_mapping->{$ds} = { path => $path,