colo-failover.c (834b9273d5cdab68180dc8c84d641aaa4344b057) colo-failover.c (d73415a315471ac0b127ed3fad45c8ec5d711de1)
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 *

--- 49 unchanged lines hidden (view full) ---

58 failover_state = FAILOVER_STATUS_NONE;
59}
60
61FailoverStatus failover_set_state(FailoverStatus old_state,
62 FailoverStatus new_state)
63{
64 FailoverStatus old;
65
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 *

--- 49 unchanged lines hidden (view full) ---

58 failover_state = FAILOVER_STATUS_NONE;
59}
60
61FailoverStatus failover_set_state(FailoverStatus old_state,
62 FailoverStatus new_state)
63{
64 FailoverStatus old;
65
66 old = atomic_cmpxchg(&failover_state, old_state, new_state);
66 old = qatomic_cmpxchg(&failover_state, old_state, new_state);
67 if (old == old_state) {
68 trace_colo_failover_set_state(FailoverStatus_str(new_state));
69 }
70 return old;
71}
72
73FailoverStatus failover_get_state(void)
74{
67 if (old == old_state) {
68 trace_colo_failover_set_state(FailoverStatus_str(new_state));
69 }
70 return old;
71}
72
73FailoverStatus failover_get_state(void)
74{
75 return atomic_read(&failover_state);
75 return qatomic_read(&failover_state);
76}
77
78void qmp_x_colo_lost_heartbeat(Error **errp)
79{
80 if (get_colo_mode() == COLO_MODE_NONE) {
81 error_setg(errp, QERR_FEATURE_DISABLED, "colo");
82 return;
83 }
84
85 failover_request_active(errp);
86}
76}
77
78void qmp_x_colo_lost_heartbeat(Error **errp)
79{
80 if (get_colo_mode() == COLO_MODE_NONE) {
81 error_setg(errp, QERR_FEATURE_DISABLED, "colo");
82 return;
83 }
84
85 failover_request_active(errp);
86}