All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: amit.shah@redhat.com, quintela@redhat.com
Cc: qemu-devel@nongnu.org, dgilbert@redhat.com, wency@cn.fujitsu.com,
	lizhijian@cn.fujitsu.com, zhangchen.fnst@cn.fujitsu.com,
	xiecl.fnst@cn.fujitsu.com,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	Gonglei <arei.gonglei@huawei.com>
Subject: [Qemu-devel] [PATCH COLO-Frame (Base) v20 02/17] COLO: migrate COLO related info to secondary node
Date: Thu, 29 Sep 2016 16:46:22 +0800	[thread overview]
Message-ID: <1475138797-9908-3-git-send-email-zhang.zhanghailiang@huawei.com> (raw)
In-Reply-To: <1475138797-9908-1-git-send-email-zhang.zhanghailiang@huawei.com>

We can determine whether or not VM in destination should go into COLO mode
by referring to the info that was migrated.

We skip this section if COLO is not enabled (i.e.
migrate_set_capability colo off), so that, It doesn't break compatibility
with migration no matter whether users configure the --enable-colo/disable-colo
on the source/destination side or not;

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: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
v19:
- fix title and comment
v16:
- Fix compile broken due to missing osdep.h
v14:
- Adjust the place of calling colo_info_init()
v11:
- Add Reviewed-by tag
v10:
- Use VMSTATE_BOOL instead of VMSTATE_UNIT32 for 'colo_requested' (Dave's suggestion)
---
 include/migration/colo.h |  2 ++
 migration/Makefile.objs  |  1 +
 migration/colo-comm.c    | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
 vl.c                     |  3 +++
 4 files changed, 57 insertions(+)
 create mode 100644 migration/colo-comm.c

diff --git a/include/migration/colo.h b/include/migration/colo.h
index 59a632a..1c899a0 100644
--- a/include/migration/colo.h
+++ b/include/migration/colo.h
@@ -14,7 +14,9 @@
 #define QEMU_COLO_H
 
 #include "qemu-common.h"
+#include "migration/migration.h"
 
 bool colo_supported(void);
+void colo_info_init(void);
 
 #endif
diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index cff96f0..4bbe9ab 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -1,6 +1,7 @@
 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 += colo-comm.o
 common-obj-y += vmstate.o
 common-obj-y += qemu-file.o
 common-obj-y += qemu-file-channel.o
diff --git a/migration/colo-comm.c b/migration/colo-comm.c
new file mode 100644
index 0000000..a2d5185
--- /dev/null
+++ b/migration/colo-comm.c
@@ -0,0 +1,51 @@
+/*
+ * 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>
+#include "trace.h"
+
+typedef struct {
+     bool colo_requested;
+} COLOInfo;
+
+static COLOInfo colo_info;
+
+static void colo_info_pre_save(void *opaque)
+{
+    COLOInfo *s = opaque;
+
+    s->colo_requested = migrate_colo_enabled();
+}
+
+static bool colo_info_need(void *opaque)
+{
+   return migrate_colo_enabled();
+}
+
+static const VMStateDescription colo_state = {
+    .name = "COLOState",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .pre_save = colo_info_pre_save,
+    .needed = colo_info_need,
+    .fields = (VMStateField[]) {
+        VMSTATE_BOOL(colo_requested, COLOInfo),
+        VMSTATE_END_OF_LIST()
+    },
+};
+
+void colo_info_init(void)
+{
+    vmstate_register(NULL, 0, &colo_state, &colo_info);
+}
diff --git a/vl.c b/vl.c
index ab0349b..403ea55 100644
--- a/vl.c
+++ b/vl.c
@@ -90,6 +90,7 @@ int main(int argc, char **argv)
 #include "audio/audio.h"
 #include "migration/migration.h"
 #include "sysemu/cpus.h"
+#include "migration/colo.h"
 #include "sysemu/kvm.h"
 #include "qapi/qmp/qjson.h"
 #include "qemu/option.h"
@@ -4415,6 +4416,8 @@ int main(int argc, char **argv, char **envp)
 #endif
     }
 
+    colo_info_init();
+
     if (net_init_clients() < 0) {
         exit(1);
     }
-- 
1.8.3.1

  parent reply	other threads:[~2016-09-29  8:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-29  8:46 [Qemu-devel] [PATCH COLO-Frame (Base) v20 00/17] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT) zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 01/17] migration: Introduce capability 'x-colo' to migration zhanghailiang
2016-09-29  8:46 ` zhanghailiang [this message]
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 03/17] migration: Enter into COLO mode after migration if COLO is enabled zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 04/17] migration: Switch to COLO process after finishing loadvm zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 05/17] COLO: Establish a new communicating path for COLO zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 06/17] COLO: Introduce checkpointing protocol zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 07/17] COLO: Add a new RunState RUN_STATE_COLO zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 08/17] COLO: Send PVM state to secondary side when do checkpoint zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 09/17] COLO: Load VMState into QIOChannelBuffer before restore it zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 10/17] COLO: Add checkpoint-delay parameter for migrate-set-parameters zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 11/17] COLO: Synchronize PVM's state to SVM periodically zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 12/17] COLO: Add 'x-colo-lost-heartbeat' command to trigger failover zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 13/17] COLO: Introduce state to record failover process zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 14/17] COLO: Implement the process of failover for primary VM zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 15/17] COLO: Implement failover work for secondary VM zhanghailiang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 16/17] docs: Add documentation for COLO feature zhanghailiang
2016-09-29 11:45   ` Jonathan Neuschäfer
2016-10-05 13:37   ` Eric Blake
2016-10-08  9:32     ` Hailiang Zhang
2016-09-29  8:46 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 17/17] configure: Support enable/disable " zhanghailiang
2016-09-29 12:10 ` [Qemu-devel] [PATCH COLO-Frame (Base) v20 00/17] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT) no-reply
2016-09-30  5:53 ` Amit Shah
2016-09-30  6:27   ` Hailiang Zhang
2016-10-05 12:13     ` Amit Shah
2016-10-09  1:21       ` 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=1475138797-9908-3-git-send-email-zhang.zhanghailiang@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=amit.shah@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=dgilbert@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=wency@cn.fujitsu.com \
    --cc=xiecl.fnst@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.