From 3bae384f751726aed4a8ff48c0e0674067566bd7 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 25 Nov 2020 14:16:28 +0100 Subject: [PATCH] clone disk: avoid errors after disk was moved by QEMU Signed-off-by: Thomas Lamprecht --- PVE/QemuServer.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 6fa23fe6..49899386 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -6951,7 +6951,7 @@ sub clone_disk { } elsif ($drivename eq 'efidisk0') { $size = get_efivars_size($conf); } else { - ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 3); + ($size) = PVE::Storage::volume_size_info($storecfg, $drive->{file}, 10); } $size /= 1024; $newvolid = PVE::Storage::vdisk_alloc($storecfg, $storeid, $newvmid, $dst_format, $name, $size); @@ -6991,12 +6991,12 @@ sub clone_disk { } no_data_clone: - my ($size) = PVE::Storage::volume_size_info($storecfg, $newvolid, 3); + my ($size) = eval { PVE::Storage::volume_size_info($storecfg, $newvolid, 10) }; my $disk = $drive; $disk->{format} = undef; $disk->{file} = $newvolid; - $disk->{size} = $size; + $disk->{size} = $size if defined($size); return $disk; }