mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
migration: Introduce capability 'x-colo' to migration
We add helper function colo_supported() to indicate whether colo is supported or not, with which we use to control whether or not showing 'x-colo' string to users, they can use qmp command 'query-migrate-capabilities' or hmp command 'info migrate_capabilities' to learn if colo is supported. The default value for COLO (COarse-Grain LOck Stepping) is disabled. Cc: Juan Quintela <quintela@redhat.com> Cc: Amit Shah <amit.shah@redhat.com> Cc: Eric Blake <eblake@redhat.com> Cc: Markus Armbruster <armbru@redhat.com> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Amit Shah <amit@amitshah.net>
This commit is contained in:
parent
5b2ecabaea
commit
35a6ed4f71
9 changed files with 89 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
common-obj-y += migration.o socket.o fd.o exec.o
|
||||
common-obj-y += tls.o
|
||||
common-obj-$(CONFIG_COLO) += colo.o
|
||||
common-obj-y += vmstate.o
|
||||
common-obj-y += qemu-file.o
|
||||
common-obj-y += qemu-file-channel.o
|
||||
|
|
19
migration/colo.c
Normal file
19
migration/colo.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
|
||||
* (a.k.a. Fault Tolerance or Continuous Replication)
|
||||
*
|
||||
* Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
|
||||
* Copyright (c) 2016 FUJITSU LIMITED
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or
|
||||
* later. See the COPYING file in the top-level directory.
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "migration/colo.h"
|
||||
|
||||
bool colo_supported(void)
|
||||
{
|
||||
return false;
|
||||
}
|
|
@ -36,6 +36,7 @@
|
|||
#include "exec/address-spaces.h"
|
||||
#include "io/channel-buffer.h"
|
||||
#include "io/channel-tls.h"
|
||||
#include "migration/colo.h"
|
||||
|
||||
#define MAX_THROTTLE (32 << 20) /* Migration transfer speed throttling */
|
||||
|
||||
|
@ -531,6 +532,9 @@ MigrationCapabilityStatusList *qmp_query_migrate_capabilities(Error **errp)
|
|||
|
||||
caps = NULL; /* silence compiler warning */
|
||||
for (i = 0; i < MIGRATION_CAPABILITY__MAX; i++) {
|
||||
if (i == MIGRATION_CAPABILITY_X_COLO && !colo_supported()) {
|
||||
continue;
|
||||
}
|
||||
if (head == NULL) {
|
||||
head = g_malloc0(sizeof(*caps));
|
||||
caps = head;
|
||||
|
@ -733,6 +737,14 @@ void qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
|
|||
}
|
||||
|
||||
for (cap = params; cap; cap = cap->next) {
|
||||
if (cap->value->capability == MIGRATION_CAPABILITY_X_COLO) {
|
||||
if (!colo_supported()) {
|
||||
error_setg(errp, "COLO is not currently supported, please"
|
||||
" configure with --enable-colo option in order to"
|
||||
" support COLO feature");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
s->enabled_capabilities[cap->value->capability] = cap->value->state;
|
||||
}
|
||||
|
||||
|
@ -1713,6 +1725,12 @@ fail:
|
|||
MIGRATION_STATUS_FAILED);
|
||||
}
|
||||
|
||||
bool migrate_colo_enabled(void)
|
||||
{
|
||||
MigrationState *s = migrate_get_current();
|
||||
return s->enabled_capabilities[MIGRATION_CAPABILITY_X_COLO];
|
||||
}
|
||||
|
||||
/*
|
||||
* Master migration thread on the source VM.
|
||||
* It drives the migration and pumps the data down the outgoing channel.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue