mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
qemuMigrationSrcBeginPhase: Don't offer 'nbd' in cookie if there are no disks to migrate
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@redhat.com> Tested-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
763a88a358
commit
53c49c88f0
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user