[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC v3 03/27] COLO: migrate colo related info to sla
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH RFC v3 03/27] COLO: migrate colo related info to slave |
Date: |
Thu, 12 Feb 2015 11:16:50 +0800 |
We can know if we should go into COLO mode by the info that
has been migrated from PVM.
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Yang Hongyang <address@hidden>
Signed-off-by: Lai Jiangshan <address@hidden>
Signed-off-by: Gonglei <address@hidden>
---
include/migration/migration-colo.h | 21 ++++++++++++++
migration/Makefile.objs | 1 +
migration/colo-comm.c | 56 ++++++++++++++++++++++++++++++++++++++
vl.c | 5 +++-
4 files changed, 82 insertions(+), 1 deletion(-)
create mode 100644 include/migration/migration-colo.h
create mode 100644 migration/colo-comm.c
diff --git a/include/migration/migration-colo.h
b/include/migration/migration-colo.h
new file mode 100644
index 0000000..d52ebd0
--- /dev/null
+++ b/include/migration/migration-colo.h
@@ -0,0 +1,21 @@
+/*
+ * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
+ * (a.k.a. Fault Tolerance or Continuous Replication)
+ *
+ * Copyright (c) 2015 HUAWEI TECHNOLOGIES CO.,LTD.
+ * Copyright (c) 2015 FUJITSU LIMITED
+ * Copyright (c) 2015 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_MIGRATION_COLO_H
+#define QEMU_MIGRATION_COLO_H
+
+#include "qemu-common.h"
+#include "migration/migration.h"
+
+void colo_info_mig_init(void);
+
+#endif
diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index d929e96..97b72ad 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -1,4 +1,5 @@
common-obj-y += migration.o tcp.o
+common-obj-y += colo-comm.o
common-obj-y += vmstate.o
common-obj-y += qemu-file.o qemu-file-buf.o qemu-file-unix.o qemu-file-stdio.o
common-obj-y += xbzrle.o
diff --git a/migration/colo-comm.c b/migration/colo-comm.c
new file mode 100644
index 0000000..8caa948
--- /dev/null
+++ b/migration/colo-comm.c
@@ -0,0 +1,56 @@
+/*
+ * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
+ * (a.k.a. Fault Tolerance or Continuous Replication)
+ *
+ * Copyright (c) 2015 HUAWEI TECHNOLOGIES CO.,LTD.
+ * Copyright (c) 2015 FUJITSU LIMITED
+ * Copyright (c) 2015 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 <migration/migration-colo.h>
+
+/* #define DEBUG_COLO */
+
+#ifdef DEBUG_COLO
+#define DPRINTF(fmt, ...) \
+ do { fprintf(stdout, "COLO: " fmt, ## __VA_ARGS__); } while (0)
+#else
+#define DPRINTF(fmt, ...) \
+ do { } while (0)
+#endif
+
+static bool colo_requested;
+
+/* save */
+static void colo_info_save(QEMUFile *f, void *opaque)
+{
+ qemu_put_byte(f, migrate_enable_colo());
+}
+
+/* restore */
+static int colo_info_load(QEMUFile *f, void *opaque, int version_id)
+{
+ int value = qemu_get_byte(f);
+
+ if (value && !colo_requested) {
+ DPRINTF("COLO requested!\n");
+ }
+ colo_requested = value;
+
+ return 0;
+}
+
+static SaveVMHandlers savevm_colo_info_handlers = {
+ .save_state = colo_info_save,
+ .load_state = colo_info_load,
+};
+
+void colo_info_mig_init(void)
+{
+ register_savevm_live(NULL, "colo", -1, 1,
+ &savevm_colo_info_handlers, NULL);
+}
diff --git a/vl.c b/vl.c
index 8c8f142..40badc4 100644
--- a/vl.c
+++ b/vl.c
@@ -89,6 +89,7 @@ int main(int argc, char **argv)
#include "sysemu/dma.h"
#include "audio/audio.h"
#include "migration/migration.h"
+#include "migration/migration-colo.h"
#include "sysemu/kvm.h"
#include "qapi/qmp/qjson.h"
#include "qemu/option.h"
@@ -4147,7 +4148,9 @@ int main(int argc, char **argv, char **envp)
blk_mig_init();
ram_mig_init();
-
+#ifdef CONFIG_COLO
+ colo_info_mig_init();
+#endif
/* If the currently selected machine wishes to override the units-per-bus
* property of its default HBA interface type, do so now. */
if (machine_class->units_per_default_bus) {
--
1.7.12.4
- [Qemu-devel] [PATCH RFC v3 26/27] COLO: Implement shutdown checkpoint, (continued)
- [Qemu-devel] [PATCH RFC v3 26/27] COLO: Implement shutdown checkpoint, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 25/27] COLO: Disable qdev hotplug when VM is in COLO mode, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 24/27] COLO NIC: Implement NIC checkpoint and failover, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 27/27] COLO: Add block replication into colo process, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 05/27] migration: Integrate COLO checkpoint process into loadvm, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 11/27] COLO RAM: Load PVM's dirty page into SVM's RAM cache temporarily, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 14/27] COLO failover: Introduce a new command to trigger a failover, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 06/27] migration: Don't send vm description in COLO mode, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 23/27] COLO: Improve checkpoint efficiency by do additional periodic checkpoint, zhanghailiang, 2015/02/11
- [Qemu-devel] [PATCH RFC v3 03/27] COLO: migrate colo related info to slave,
zhanghailiang <=
- Re: [Qemu-devel] [PATCH RFC v3 00/27] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service, Dr. David Alan Gilbert, 2015/02/16
- Re: [Qemu-devel] [PATCH RFC v3 00/27] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service, Dr. David Alan Gilbert, 2015/02/24
- Re: [Qemu-devel] [PATCH RFC v3 00/27] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service, Dr. David Alan Gilbert, 2015/02/24