From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: qemu-devel@nongnu.org, amit.shah@redhat.com, quintela@redhat.com,
dgilbert@redhat.com
Cc: peter.huangpeng@huawei.com, eddie.dong@intel.com,
yunhong.jiang@intel.com, wency@cn.fujitsu.com,
lizhijian@cn.fujitsu.com, arei.gonglei@huawei.com,
stefanha@redhat.com, hongyang.yang@easystack.cn,
zhangchen.fnst@cn.fujitsu.com, xiecl.fnst@cn.fujitsu.com,
zhanghailiang <zhang.zhanghailiang@huawei.com>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH COLO-Frame v17 02/34] migration: Introduce capability 'x-colo' to migration
Date: Fri, 3 Jun 2016 15:52:14 +0800 [thread overview]
Message-ID: <1464940366-9880-3-git-send-email-zhang.zhanghailiang@huawei.com> (raw)
In-Reply-To: <1464940366-9880-1-git-send-email-zhang.zhanghailiang@huawei.com>
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.
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>
---
v16:
- fix compile broken due to missing osdep.h
v14:
- Fix the date of Copyright to 2016
v10:
- Rename capability 'colo' to experimental 'x-colo' (Eric's suggestion).
- Rename migrate_enable_colo() to migrate_colo_enabled() (Eric's suggestion).
---
include/migration/colo.h | 20 ++++++++++++++++++++
include/migration/migration.h | 1 +
migration/Makefile.objs | 1 +
migration/colo.c | 19 +++++++++++++++++++
migration/migration.c | 18 ++++++++++++++++++
qapi-schema.json | 6 +++++-
qmp-commands.hx | 2 +-
stubs/Makefile.objs | 1 +
stubs/migration-colo.c | 19 +++++++++++++++++++
9 files changed, 85 insertions(+), 2 deletions(-)
create mode 100644 include/migration/colo.h
create mode 100644 migration/colo.c
create mode 100644 stubs/migration-colo.c
diff --git a/include/migration/colo.h b/include/migration/colo.h
new file mode 100644
index 0000000..59a632a
--- /dev/null
+++ b/include/migration/colo.h
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+#ifndef QEMU_COLO_H
+#define QEMU_COLO_H
+
+#include "qemu-common.h"
+
+bool colo_supported(void);
+
+#endif
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 13b12b7..3250bf3 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -299,6 +299,7 @@ int xbzrle_decode_buffer(uint8_t *src, int slen, uint8_t *dst, int dlen);
int migrate_use_xbzrle(void);
int64_t migrate_xbzrle_cache_size(void);
+bool migrate_colo_enabled(void);
int64_t xbzrle_cache_resize(int64_t new_size);
diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index 30ad945..cff96f0 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -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
diff --git a/migration/colo.c b/migration/colo.c
new file mode 100644
index 0000000..5749016
--- /dev/null
+++ b/migration/colo.c
@@ -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 true;
+}
diff --git a/migration/migration.c b/migration/migration.c
index 7ecbade..b62e415 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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 */
@@ -537,6 +538,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;
@@ -739,6 +743,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;
}
@@ -1693,6 +1705,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.
diff --git a/qapi-schema.json b/qapi-schema.json
index 8483bdf..2a9a607 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -549,11 +549,15 @@
# been migrated, pulling the remaining pages along as needed. NOTE: If
# the migration fails during postcopy the VM will fail. (since 2.6)
#
+# @x-colo: If enabled, migration will never end, and the state of the VM on the
+# primary side will be migrated continuously to the VM on secondary
+# side. (since 2.7)
+#
# Since: 1.2
##
{ 'enum': 'MigrationCapability',
'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
- 'compress', 'events', 'postcopy-ram'] }
+ 'compress', 'events', 'postcopy-ram', 'x-colo'] }
##
# @MigrationCapabilityStatus
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 28801a2..34d82c3 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3713,7 +3713,7 @@ Query current migration capabilities
- "zero-blocks" : Zero Blocks state (json-bool)
- "compress": Multiple compression threads state (json-bool)
- "events": Migration state change event state (json-bool)
- - "postcopy-ram": postcopy ram state (json-bool)
+ - "x-colo" : COarse-Grain LOck Stepping for Non-stop Service (json-bool)
Arguments:
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 4b258a6..f4284db 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -41,3 +41,4 @@ stub-obj-y += target-monitor-defs.o
stub-obj-y += target-get-monitor-def.o
stub-obj-y += vhost.o
stub-obj-y += iohandler.o
+stub-obj-y += migration-colo.o
diff --git a/stubs/migration-colo.c b/stubs/migration-colo.c
new file mode 100644
index 0000000..d215057
--- /dev/null
+++ b/stubs/migration-colo.c
@@ -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;
+}
--
1.8.3.1
next prev parent reply other threads:[~2016-06-03 7:53 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-03 7:52 [Qemu-devel] [PATCH COLO-Frame v17 00/34] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT) zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 01/34] configure: Add parameter for configure to enable/disable COLO support zhanghailiang
2016-06-03 7:52 ` zhanghailiang [this message]
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 03/34] COLO: migrate colo related info to secondary node zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 04/34] migration: Integrate COLO checkpoint process into migration zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 05/34] migration: Integrate COLO checkpoint process into loadvm zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 06/34] COLO/migration: Create a new communication path from destination to source zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 07/34] COLO: Implement COLO checkpoint protocol zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 08/34] COLO: Add a new RunState RUN_STATE_COLO zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 09/34] COLO: Save PVM state to secondary side when do checkpoint zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 10/34] COLO: Load PVM's dirty pages into SVM's RAM cache temporarily zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 11/34] ram/COLO: Record the dirty pages that SVM received zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 12/34] COLO: Load VMState into buffer before restore it zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 13/34] COLO: Flush PVM's cached RAM into SVM's memory zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 14/34] COLO: Add checkpoint-delay parameter for migrate-set-parameters zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 15/34] COLO: Synchronize PVM's state to SVM periodically zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 16/34] COLO failover: Introduce a new command to trigger a failover zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 17/34] COLO failover: Introduce state to record failover process zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 18/34] COLO: Implement failover work for Primary VM zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 19/34] COLO: Implement failover work for Secondary VM zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 20/34] qmp event: Add COLO_EXIT event to notify users while exited from COLO zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 21/34] COLO failover: Shutdown related socket fd when do failover zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 22/34] COLO failover: Don't do failover during loading VM's state zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 23/34] COLO: Process shutdown command for VM in COLO state zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 24/34] COLO: Update the global runstate after going into colo state zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 25/34] savevm: Introduce two helper functions for save/find loadvm_handlers entry zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 26/34] migration/savevm: Add new helpers to process the different stages of loadvm zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 27/34] migration/savevm: Export two helper functions for savevm process zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 28/34] COLO: Separate the process of saving/loading ram and device state zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 29/34] COLO: Split qemu_savevm_state_begin out of checkpoint process zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 30/34] filter-buffer: Accept zero interval zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 31/34] net: Add notifier/callback for netdev init zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 32/34] COLO/filter: Add each netdev a buffer filter zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 33/34] COLO: Control the status of buffer filters for PVM zhanghailiang
2016-06-03 7:52 ` [Qemu-devel] [PATCH COLO-Frame v17 34/34] COLO: Add block replication into colo process zhanghailiang
2016-06-07 12:06 ` [Qemu-devel] [PATCH COLO-Frame v17 00/34] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT) Dr. David Alan Gilbert
2016-06-08 0:47 ` Hailiang Zhang
2016-07-28 19:07 ` Dr. David Alan Gilbert
2016-07-29 0:41 ` Hailiang Zhang
2016-07-29 0:55 ` Changlong Xie
2016-07-29 0:55 ` Hailiang Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464940366-9880-3-git-send-email-zhang.zhanghailiang@huawei.com \
--to=zhang.zhanghailiang@huawei.com \
--cc=amit.shah@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=eddie.dong@intel.com \
--cc=hongyang.yang@easystack.cn \
--cc=lizhijian@cn.fujitsu.com \
--cc=peter.huangpeng@huawei.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=wency@cn.fujitsu.com \
--cc=xiecl.fnst@cn.fujitsu.com \
--cc=yunhong.jiang@intel.com \
--cc=zhangchen.fnst@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).