For qcow2 on LVM, it is necessary that the volumes are active to be
able to query the size. For offline migration, the volumes would be
activated later in storage_migrate() and for online migration, the
volumes are already active.

This makes an attempt to offline migrate a qcow2 on LVM volume
correctly fail with an error about lacking support, rather than an
error about not being to determine the size. See also commit
"migration: abort early when size or format cannot be determined" for
context.

Signed-off-by: Fiona Ebner <[email protected]>
---
 src/PVE/QemuMigrate.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm
index 6b563343..8da6f15d 100644
--- a/src/PVE/QemuMigrate.pm
+++ b/src/PVE/QemuMigrate.pm
@@ -449,6 +449,8 @@ sub scan_local_volumes {
             $local_volumes->{$volid}->{bwlimit} = $self->get_bwlimit($sid, 
$targetsid);
             $local_volumes->{$volid}->{targetsid} = $targetsid;
 
+            # For some volumes, like qcow2 on LVM, it is necessary to activate 
to query the size.
+            PVE::Storage::activate_volumes($storecfg, [$volid]);
             $local_volumes->{$volid}->@{qw(size format)} =
                 PVE::Storage::volume_size_info($storecfg, $volid);
             die "unable to determine size for volume '$volid'\n"
-- 
2.47.3




Reply via email to