[PATCH 1/8] qemu: migration: Fix setup of non-shared storage migration in qemuMigrationSrcBeginPhase

Peter Krempa pkrempa at redhat.com
Thu Sep 8 12:13:01 UTC 2022


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 at redhat.com>
---
 src/qemu/qemu_migration.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 76a65bf298..5367b74de4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -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) ||
-- 
2.37.1



More information about the libvir-list mailing list