5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-08 21:18:03 +03:00

Fix 2070: vm_start: for a migrating VM, use current format of disk if possible

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2020-01-20 14:00:43 +01:00 committed by Thomas Lamprecht
parent 3d48b95aa8
commit c3c5d2b6b3

View File

@ -5376,13 +5376,16 @@ sub vm_start {
my ($volid, $storeid, $volname) = @{$local_volumes->{$opt}};
my $drive = parse_drive($opt, $conf->{$opt});
#if remote storage is specified, use default format
# If a remote storage is specified and the format of the original
# volume is not available there, fall back to the default format.
# Otherwise use the same format as the original.
if ($targetstorage && $targetstorage ne "1") {
$storeid = $targetstorage;
my ($defFormat, $validFormats) = PVE::Storage::storage_default_format($storecfg, $storeid);
$format = $defFormat;
my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
my $fileFormat = qemu_img_format($scfg, $volname);
$format = (grep {$fileFormat eq $_} @{$validFormats}) ? $fileFormat : $defFormat;
} else {
#else we use same format than original
my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
$format = qemu_img_format($scfg, $volid);
}