5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2024-12-22 13:34:06 +03:00

clone disk: avoid errors after disk was moved by QEMU

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-11-25 14:16:28 +01:00
parent 1b987638a8
commit 3bae384f75

View File

@ -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;
}