Add a migration capability 'colo'. If this capability is on, The migration will never end, and the VM will be continuously checkpointed.
Signed-off-by: Yang Hongyang <yan...@cn.fujitsu.com> --- migration.c | 8 ++++++++ qapi-schema.json | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/migration.c b/migration.c index 8d675b3..5d28237 100644 --- a/migration.c +++ b/migration.c @@ -25,6 +25,7 @@ #include "qemu/thread.h" #include "qmp-commands.h" #include "trace.h" +#include "migration/migration-colo.h" enum { MIG_STATE_ERROR = -1, @@ -277,6 +278,13 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params, } for (cap = params; cap; cap = cap->next) { + if (cap->value->capability == MIGRATION_CAPABILITY_COLO && + cap->value->state && !colo_supported()) { + error_setg(errp, "COLO is not currently supported, please rerun" + " configure with --enable-colo option in order to" + " support COLO feature"); + continue; + } s->enabled_capabilities[cap->value->capability] = cap->value->state; } } diff --git a/qapi-schema.json b/qapi-schema.json index 689b548..8d58ef7 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -491,10 +491,13 @@ # @auto-converge: If enabled, QEMU will automatically throttle down the guest # to speed up convergence of RAM migration. (since 1.6) # +# @colo: If enabled, the migration will never end, and the VM will instead be +# continuously checkpointed. (since 2.2) +# # Since: 1.2 ## { 'enum': 'MigrationCapability', - 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks'] } + 'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks', 'colo'] } ## # @MigrationCapabilityStatus -- 1.9.1