From 0ad295f9fba9ffb2f2af5358c1a444859f36e625 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Mon, 9 Mar 2020 13:24:51 +0100 Subject: [PATCH] Consistently use format determined in 'PVE::Storage::foreach_volid' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabian Ebner LGTM-by: Fabian Grünbichler --- PVE/QemuMigrate.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index aa8ee6e4..44e4c57d 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -319,6 +319,7 @@ sub sync_disks { # a raw+size stream, but on-the-fly conversion from qcow2 to raw+size # back to qcow2 is currently not possible. $local_volumes->{$volid}->{snapshots} = ($volinfo->{format} =~ /^(?:qcow2|vmdk)$/); + $local_volumes->{$volid}->{format} = $volinfo->{format}; }); } @@ -370,7 +371,6 @@ sub sync_disks { die "owned by other VM (owner = VM $owner)\n" if !$owner || ($owner != $self->{vmid}); - my $format = PVE::QemuServer::qemu_img_format($scfg, $volname); if (defined($snaprefs)) { $local_volumes->{$volid}->{snapshots} = 1; @@ -378,7 +378,7 @@ sub sync_disks { # exceptions: 'zfspool' or 'qcow2' files (on directory storage) die "online storage migration not possible if snapshot exists\n" if $self->{running}; - if (!($scfg->{type} eq 'zfspool' || $format eq 'qcow2')) { + if (!($scfg->{type} eq 'zfspool' || $local_volumes->{$volid}->{format} eq 'qcow2')) { die "non-migratable snapshot exists\n"; } }