]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: migration: Fix setup of non-shared storage migration in qemuMigrationSrcBeginPhase
authorPeter Krempa <pkrempa@redhat.com>
Thu, 8 Sep 2022 09:55:08 +0000 (11:55 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 9 Sep 2022 14:10:47 +0000 (16:10 +0200)
In commit 6111b2352242e9 removing pre-blockdev code paths I've
improperly refactored the setup of non-shared storage migration.

Specifically the code checking that there are disks and setting up the
NBD data in the migration cookie was originally outside of the loop
checking the user provided list of specific disks to migrate, but became
part of the block as it was not un-indented when a higher level block
was being removed.

The above caused that if non-shared storage migration is requested, but
the user doesn't provide the list of disks to migrate (thus implying to
migrate every appropriate disk) the code doesn't actually setup the
migration and then later on falls back to the old-style migration which
no longer works with blockdev.

Move the check that there's anything to migrate out of the
'nmigrate_disks' block.

Fixes: 6111b2352242e93c6d2c29f9549d596ed1056ce5
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2125111
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/373
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_migration.c

index 76a65bf2989ca49b788226cf5fa9b18fa7f57543..5367b74de47ab5ef1229cb4bad153056843a8fc6 100644 (file)
@@ -2609,14 +2609,14 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver,
                     return NULL;
                 }
             }
+        }
 
-            priv->nbdPort = 0;
+        priv->nbdPort = 0;
 
-            if (qemuMigrationHasAnyStorageMigrationDisks(vm->def,
-                                                         migrate_disks,
-                                                         nmigrate_disks))
-                cookieFlags |= QEMU_MIGRATION_COOKIE_NBD;
-        }
+        if (qemuMigrationHasAnyStorageMigrationDisks(vm->def,
+                                                     migrate_disks,
+                                                     nmigrate_disks))
+            cookieFlags |= QEMU_MIGRATION_COOKIE_NBD;
     }
 
     if (virDomainDefHasMemoryHotplug(vm->def) ||