]> git.proxmox.com Git - qemu-server.git/commitdiff
close #2792: allow online migration with replicated snapshots
authorFiona Ebner <f.ebner@proxmox.com>
Wed, 18 Jan 2023 13:52:40 +0000 (14:52 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 27 Jan 2023 08:53:28 +0000 (09:53 +0100)
Since commit 9b6efe43 ("migrate: add live-migration of replicated
disks") live-migration with replicated volumes is possible. When
handling the replication, it is checked that all local volumes
previously detected as replicatable are actually replicated. So the
check if migration with snapshots is possible can just allow volumes
that are detected as replicatable.

Note that VM state files are also replicated.

If there is an invalid configuration with a non-replicatable volume or
state file and replication is enabled, then replication will fail, and
thus migration will fail early.

Trying to live-migrate to a non-replication target (needs --force)
will still fail if there are snapshots, because they are (correctly)
detected as non-replicated.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
PVE/QemuMigrate.pm
test/run_qemu_migrate_tests.pl

index cb0afaa7c776d9d50c8496f244ad732cf7588c4f..09cc1d83ee275884e8968fc2d18d19076c44b425 100644 (file)
@@ -433,7 +433,9 @@ sub scan_local_volumes {
                # we cannot migrate shapshots on local storage
                # exceptions: 'zfspool' or 'qcow2' files (on directory storage)
 
-               die "online storage migration not possible if snapshot exists\n" if $self->{running};
+               die "online storage migration not possible if non-replicated snapshot exists\n"
+                   if $self->{running} && !$local_volumes->{$volid}->{replicated};
+
                die "remote migration with snapshots not supported yet\n" if $self->{opts}->{remote};
 
                if (!($scfg->{type} eq 'zfspool'
index 0dffaa430e91a07ab9f7a62e38ca6baefd0ad35a..3a3049d7da0b6ebddc6e0ab1bae102540464b745 100755 (executable)
@@ -678,7 +678,7 @@ my $tests = [
            'with-local-disks' => 1,
        },
        expected_calls => {},
-       expect_die => 'online storage migration not possible if snapshot exists',
+       expect_die => 'online storage migration not possible if non-replicated snapshot exists',
        expected => {
            source_volids => local_volids_for_vm(4567),
            target_volids => {},
@@ -1237,8 +1237,11 @@ my $tests = [
            'with-local-disks' => 1,
        },
        target_volids => local_volids_for_vm(105),
-       expected_calls => {},
-       expect_die => "online storage migration not possible if snapshot exists",
+       expected_calls => {
+           %{$replicated_expected_calls_online},
+           'block-dirty-bitmap-add-drive-scsi0' => 1,
+           'block-dirty-bitmap-add-drive-ide0' => 1,
+       },
        expected => {
            source_volids => local_volids_for_vm(105),
            target_volids => local_volids_for_vm(105),