[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH COLO-Frame v16 03/35] COLO: migrate colo related inf
From: |
zhanghailiang |
Subject: |
[Qemu-devel] [PATCH COLO-Frame v16 03/35] COLO: migrate colo related info to secondary node |
Date: |
Fri, 8 Apr 2016 14:26:05 +0800 |
We can know if VM in destination should go into COLO mode by refer to
the info that been migrated from PVM.
We skip this section if colo is not enabled (i.e.
migrate_set_capability colo off), so that, It not break compatibility with
migration
however the --enable-colo/disable-colo on the source/destination;
Signed-off-by: zhanghailiang <address@hidden>
Signed-off-by: Li Zhijian <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
---
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 | 4 +++-
4 files changed, 57 insertions(+), 1 deletion(-)
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 65ecc35..81b5713 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -1,5 +1,6 @@
common-obj-y += migration.o tcp.o
common-obj-$(CONFIG_COLO) += colo.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 postcopy-ram.o
diff --git a/migration/colo-comm.c b/migration/colo-comm.c
new file mode 100644
index 0000000..2d06ace
--- /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 3629336..50b3a48 100644
--- a/vl.c
+++ b/vl.c
@@ -87,6 +87,7 @@ int main(int argc, char **argv)
#include "sysemu/dma.h"
#include "audio/audio.h"
#include "migration/migration.h"
+#include "migration/colo.h"
#include "sysemu/kvm.h"
#include "qapi/qmp/qjson.h"
#include "qemu/option.h"
@@ -4400,6 +4401,8 @@ int main(int argc, char **argv, char **envp)
/* clean up network at qemu process termination */
atexit(&net_cleanup);
+ colo_info_init();
+
if (net_init_clients() < 0) {
exit(1);
}
@@ -4431,7 +4434,6 @@ int main(int argc, char **argv, char **envp)
blk_mig_init();
ram_mig_init();
-
/* 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.8.3.1
- [Qemu-devel] [PATCH COLO-Frame v16 for-2.7 00/35] COarse-grain LOck-stepping(COLO) Virtual Machines for Non-stop Service (FT), zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 03/35] COLO: migrate colo related info to secondary node,
zhanghailiang <=
- [Qemu-devel] [PATCH COLO-Frame v16 05/35] migration: Integrate COLO checkpoint process into loadvm, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 02/35] migration: Introduce capability 'x-colo' to migration, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 01/35] configure: Add parameter for configure to enable/disable COLO support, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 06/35] COLO/migration: Create a new communication path from destination to source, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 07/35] COLO: Implement colo checkpoint protocol, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 04/35] migration: Integrate COLO checkpoint process into migration, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 09/35] QEMUSizedBuffer: Introduce two help functions for qsb, zhanghailiang, 2016/04/08
- [Qemu-devel] [PATCH COLO-Frame v16 13/35] COLO: Load VMState into qsb before restore it, zhanghailiang, 2016/04/08