Don't try to setup disk migration and the NBD stuff if we end up
migrating nothing.
The destination side has luckily no setup for the non-NBD cases so
omitting the element fully is okay.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_migration.c | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 119459342e..3a622d38cd 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2365,26 +2365,30 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver,
return NULL;
}
} else {
- cookieFlags |= QEMU_MIGRATION_COOKIE_NBD;
- priv->nbdPort = 0;
- }
-
- if (nmigrate_disks) {
- size_t i, j;
- /* Check user requested only known disk targets. */
- for (i = 0; i < nmigrate_disks; i++) {
- for (j = 0; j < vm->def->ndisks; j++) {
- if (STREQ(vm->def->disks[j]->dst, migrate_disks[i]))
- break;
- }
+ if (nmigrate_disks) {
+ size_t i, j;
+ /* Check user requested only known disk targets. */
+ for (i = 0; i < nmigrate_disks; i++) {
+ for (j = 0; j < vm->def->ndisks; j++) {
+ if (STREQ(vm->def->disks[j]->dst, migrate_disks[i]))
+ break;
+ }
- if (j == vm->def->ndisks) {
- virReportError(VIR_ERR_INVALID_ARG,
- _("disk target %s not found"),
- migrate_disks[i]);
- return NULL;
+ if (j == vm->def->ndisks) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("disk target %s not found"),
+ migrate_disks[i]);
+ return NULL;
+ }
}
}
+
+ priv->nbdPort = 0;
+
+ if (qemuMigrationHasAnyStorageMigrationDisks(vm->def,
+ migrate_disks,
+ nmigrate_disks))
+ cookieFlags |= QEMU_MIGRATION_COOKIE_NBD;
}
}
--
2.30.2