From e50dde06fae2a33334ff305ac25c697aad1e72b9 Mon Sep 17 00:00:00 2001 From: Fiona Ebner Date: Fri, 6 Dec 2024 17:25:21 +0100 Subject: [PATCH] volume export: rely on storage plugin's format Make it consistent with importing, which already relies on parse_volname() for the format. This could cause migration failures where the format returned by file_size_info() would not match the one from parse_volname(). Pass the format that will be used for export to file_size_info() to ensure the correct size will be determined. Signed-off-by: Fiona Ebner --- src/PVE/Storage/Plugin.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm index 3059d80..a90aed9 100644 --- a/src/PVE/Storage/Plugin.pm +++ b/src/PVE/Storage/Plugin.pm @@ -1679,7 +1679,8 @@ sub volume_export { my $err_msg = "volume export format $format not available for $class\n"; if ($scfg->{path} && !defined($snapshot) && !defined($base_snapshot)) { my $file = $class->path($scfg, $volname, $storeid) or die $err_msg; - my ($size, $file_format) = file_size_info($file); + my $file_format = ($class->parse_volname($volname))[6]; + my $size = file_size_info($file, undef, $file_format); if ($format eq 'raw+size') { die $err_msg if $with_snapshots || $file_format eq 'subvol'; @@ -1713,7 +1714,8 @@ sub volume_export_formats { if ($scfg->{path} && !defined($snapshot) && !defined($base_snapshot)) { my $file = $class->path($scfg, $volname, $storeid) or return; - my ($size, $format) = file_size_info($file); + my $format = ($class->parse_volname($volname))[6]; + my $size = file_size_info($file, undef, $format); if ($with_snapshots) { return ($format.'+size') if ($format eq 'qcow2' || $format eq 'vmdk');