diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index 24e53687838ebab0e61ae2eb349ba88bc47cbb1c..623193cf6c6ee21c9cc53fdef499cd22f271eb5d 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,