]> git.proxmox.com Git - mirror_qemu.git/blame - migration/colo-comm.c
migration: Enter into COLO mode after migration if COLO is enabled
[mirror_qemu.git] / migration / colo-comm.c
CommitLineData
5821ebf9
HZ
1/*
2 * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
3 * (a.k.a. Fault Tolerance or Continuous Replication)
4 *
5 * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
6 * Copyright (c) 2016 FUJITSU LIMITED
7 * Copyright (c) 2016 Intel Corporation
8 *
9 * This work is licensed under the terms of the GNU GPL, version 2 or
10 * later. See the COPYING file in the top-level directory.
11 *
12 */
13
14#include "qemu/osdep.h"
15#include <migration/colo.h>
16#include "trace.h"
17
18typedef struct {
19 bool colo_requested;
20} COLOInfo;
21
22static COLOInfo colo_info;
23
24static void colo_info_pre_save(void *opaque)
25{
26 COLOInfo *s = opaque;
27
28 s->colo_requested = migrate_colo_enabled();
29}
30
31static bool colo_info_need(void *opaque)
32{
33 return migrate_colo_enabled();
34}
35
36static const VMStateDescription colo_state = {
37 .name = "COLOState",
38 .version_id = 1,
39 .minimum_version_id = 1,
40 .pre_save = colo_info_pre_save,
41 .needed = colo_info_need,
42 .fields = (VMStateField[]) {
43 VMSTATE_BOOL(colo_requested, COLOInfo),
44 VMSTATE_END_OF_LIST()
45 },
46};
47
48void colo_info_init(void)
49{
50 vmstate_register(NULL, 0, &colo_state, &colo_info);
51}