The qemuMigrationParamsApply internal API was designed to apply all migration parameters and capabilities before we start to migrate a domain. The API can also be called outside migration job, e.g., via a call to qemuDomainMigrateSetMaxSpeed with VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY flag, but in that case it should only apply migration parameters and ignore capabilities. Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- Notes: Best viewed with --ignore-all-space src/qemu/qemu_migration_params.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index 24e5368783..623193cf6c 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -778,14 +778,23 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) return -1; - if (!(caps = qemuMigrationCapsToJSON(priv->migrationCaps, migParams->caps))) - goto cleanup; - - if (virJSONValueArraySize(caps) > 0) { - rc = qemuMonitorSetMigrationCapabilities(priv->mon, caps); - caps = NULL; - if (rc < 0) + if (asyncJob == QEMU_ASYNC_JOB_NONE) { + if (!virBitmapIsAllClear(migParams->caps)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Migration capabilities can only be set by " + "a migration job")); goto cleanup; + } + } else { + if (!(caps = qemuMigrationCapsToJSON(priv->migrationCaps, migParams->caps))) + goto cleanup; + + if (virJSONValueArraySize(caps) > 0) { + rc = qemuMonitorSetMigrationCapabilities(priv->mon, caps); + caps = NULL; + if (rc < 0) + goto cleanup; + } } /* If QEMU is too old to support xbzrle-cache-size migration parameter, -- 2.21.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list