mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2024-12-22 13:34:16 +03:00
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 <f.ebner@proxmox.com>
This commit is contained in:
parent
83648951d7
commit
e50dde06fa
@ -1679,7 +1679,8 @@ sub volume_export {
|
|||||||
my $err_msg = "volume export format $format not available for $class\n";
|
my $err_msg = "volume export format $format not available for $class\n";
|
||||||
if ($scfg->{path} && !defined($snapshot) && !defined($base_snapshot)) {
|
if ($scfg->{path} && !defined($snapshot) && !defined($base_snapshot)) {
|
||||||
my $file = $class->path($scfg, $volname, $storeid) or die $err_msg;
|
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') {
|
if ($format eq 'raw+size') {
|
||||||
die $err_msg if $with_snapshots || $file_format eq 'subvol';
|
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)) {
|
if ($scfg->{path} && !defined($snapshot) && !defined($base_snapshot)) {
|
||||||
my $file = $class->path($scfg, $volname, $storeid)
|
my $file = $class->path($scfg, $volname, $storeid)
|
||||||
or return;
|
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) {
|
if ($with_snapshots) {
|
||||||
return ($format.'+size') if ($format eq 'qcow2' || $format eq 'vmdk');
|
return ($format.'+size') if ($format eq 'qcow2' || $format eq 'vmdk');
|
||||||
|
Loading…
Reference in New Issue
Block a user