COLO: Add 'x-colo-lost-heartbeat' command to trigger failover
[qemu/ar7.git] / migration / colo-failover.c
blobe31fc10c826880d1c0502931df44464948d7f86a
1 /*
2 * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
3 * (a.k.a. Fault Tolerance or Continuous Replication)
5 * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
6 * Copyright (c) 2016 FUJITSU LIMITED
7 * Copyright (c) 2016 Intel Corporation
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.
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"
19 static QEMUBH *failover_bh;
21 static void colo_failover_bh(void *opaque)
23 qemu_bh_delete(failover_bh);
24 failover_bh = NULL;
25 /* TODO: Do failover work */
28 void failover_request_active(Error **errp)
30 failover_bh = qemu_bh_new(colo_failover_bh, NULL);
31 qemu_bh_schedule(failover_bh);
34 void qmp_x_colo_lost_heartbeat(Error **errp)
36 if (get_colo_mode() == COLO_MODE_UNKNOWN) {
37 error_setg(errp, QERR_FEATURE_DISABLED, "colo");
38 return;
41 failover_request_active(errp);