From 83ffeae75a0dfe8077d5e98f8a48615c62db0284 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Thu, 8 Sep 2022 11:55:08 +0200 Subject: [PATCH] qemu: migration: Fix setup of non-shared storage migration in qemuMigrationSrcBeginPhase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- src/qemu/qemu_migration.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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; - - if (qemuMigrationHasAnyStorageMigrationDisks(vm->def, - migrate_disks, - nmigrate_disks)) - cookieFlags |= QEMU_MIGRATION_COOKIE_NBD; } + + priv->nbdPort = 0; + + if (qemuMigrationHasAnyStorageMigrationDisks(vm->def, + migrate_disks, + nmigrate_disks)) + cookieFlags |= QEMU_MIGRATION_COOKIE_NBD; } if (virDomainDefHasMemoryHotplug(vm->def) ||