qemu: migration: Fix setup of non-shared storage migration in qemuMigrationSrcBeginPhase

In commit 6111b23522 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: 6111b23522
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>
This commit is contained in:
Peter Krempa 2022-09-08 11:55:08 +02:00
parent f3ca66acc0
commit 83ffeae75a

View File

@ -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) ||