]> git.proxmox.com Git - mirror_qemu.git/blame - migration/colo-failover.c
COLO: Add 'x-colo-lost-heartbeat' command to trigger failover
[mirror_qemu.git] / migration / colo-failover.c
CommitLineData
d89e666e
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#include "qemu/osdep.h"
14#include "migration/colo.h"
15#include "migration/failover.h"
16#include "qmp-commands.h"
17#include "qapi/qmp/qerror.h"
18
19static QEMUBH *failover_bh;
20
21static void colo_failover_bh(void *opaque)
22{
23 qemu_bh_delete(failover_bh);
24 failover_bh = NULL;
25 /* TODO: Do failover work */
26}
27
28void failover_request_active(Error **errp)
29{
30 failover_bh = qemu_bh_new(colo_failover_bh, NULL);
31 qemu_bh_schedule(failover_bh);
32}
33
34void qmp_x_colo_lost_heartbeat(Error **errp)
35{
36 if (get_colo_mode() == COLO_MODE_UNKNOWN) {
37 error_setg(errp, QERR_FEATURE_DISABLED, "colo");
38 return;
39 }
40
41 failover_request_active(errp);
42}