All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Juan Quintela <quintela@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	qemu list <qemu-devel@nongnu.org>,
	zhang.zhanghailiang@huawei.com
Subject: [Qemu-devel] [PULL 02/18] COLO: migrate COLO related info to secondary node
Date: Sun, 30 Oct 2016 16:16:54 +0530	[thread overview]
Message-ID: <1477824430-1460-3-git-send-email-amit.shah@redhat.com> (raw)
In-Reply-To: <1477824430-1460-1-git-send-email-amit.shah@redhat.com>

From: zhanghailiang <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>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Amit Shah <amit@amitshah.net>
---
 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 74dfe4e..a1cee4f 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"
@@ -4426,6 +4427,8 @@ int main(int argc, char **argv, char **envp)
 #endif
     }
 
+    colo_info_init();
+
     if (net_init_clients() < 0) {
         exit(1);
     }
-- 
2.7.4

  parent reply	other threads:[~2016-10-30 10:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-30 10:46 [Qemu-devel] [PULL 00/18] migration: COLO Amit Shah
2016-10-30 10:46 ` [Qemu-devel] [PULL 01/18] migration: Introduce capability 'x-colo' to migration Amit Shah
2016-10-30 10:46 ` Amit Shah [this message]
2016-10-30 10:46 ` [Qemu-devel] [PULL 03/18] migration: Enter into COLO mode after migration if COLO is enabled Amit Shah
2016-10-31 22:27   ` Eric Blake
2016-11-01  3:39     ` Hailiang Zhang
2016-10-30 10:46 ` [Qemu-devel] [PULL 04/18] migration: Switch to COLO process after finishing loadvm Amit Shah
2016-10-30 10:46 ` [Qemu-devel] [PULL 05/18] COLO: Establish a new communicating path for COLO Amit Shah
2016-10-30 10:46 ` [Qemu-devel] [PULL 06/18] COLO: Introduce checkpointing protocol Amit Shah
2016-10-31 18:25   ` Eduardo Habkost
2016-11-01  1:48     ` Hailiang Zhang
2016-10-30 10:46 ` [Qemu-devel] [PULL 07/18] COLO: Add a new RunState RUN_STATE_COLO Amit Shah
2016-10-30 10:47 ` [Qemu-devel] [PULL 08/18] COLO: Send PVM state to secondary side when do checkpoint Amit Shah
2016-10-30 10:47 ` [Qemu-devel] [PULL 09/18] COLO: Load VMState into QIOChannelBuffer before restore it Amit Shah
2016-10-30 10:47 ` [Qemu-devel] [PULL 10/18] COLO: Add checkpoint-delay parameter for migrate-set-parameters Amit Shah
2016-10-31 17:17   ` Juan Quintela
2016-11-01  2:10     ` Hailiang Zhang
2016-10-30 10:47 ` [Qemu-devel] [PULL 11/18] COLO: Synchronize PVM's state to SVM periodically Amit Shah
2016-10-30 10:47 ` [Qemu-devel] [PULL 12/18] COLO: Add 'x-colo-lost-heartbeat' command to trigger failover Amit Shah
2016-10-30 10:47 ` [Qemu-devel] [PULL 13/18] COLO: Introduce state to record failover process Amit Shah
2016-10-30 10:47 ` [Qemu-devel] [PULL 14/18] COLO: Implement the process of failover for primary VM Amit Shah
2016-10-30 10:47 ` [Qemu-devel] [PULL 15/18] COLO: Implement failover work for secondary VM Amit Shah
2016-10-30 10:47 ` [Qemu-devel] [PULL 16/18] docs: Add documentation for COLO feature Amit Shah
2016-10-30 10:47 ` [Qemu-devel] [PULL 17/18] configure: Support enable/disable " Amit Shah
2016-10-30 10:47 ` [Qemu-devel] [PULL 18/18] MAINTAINERS: Add maintainer for COLO framework related files Amit Shah
2016-10-31 13:57 ` [Qemu-devel] [PULL 00/18] migration: COLO Peter Maydell

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=1477824430-1460-3-git-send-email-amit.shah@redhat.com \
    --to=amit.shah@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=zhang.zhanghailiang@huawei.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.