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 "sysemu/sysemu.h"
15 #include "migration/colo.h"
18 bool colo_supported(void)
23 bool migration_in_colo_state(void)
25 MigrationState
*s
= migrate_get_current();
27 return (s
->state
== MIGRATION_STATUS_COLO
);
30 bool migration_incoming_in_colo_state(void)
32 MigrationIncomingState
*mis
= migration_incoming_get_current();
34 return mis
&& (mis
->state
== MIGRATION_STATUS_COLO
);
37 static void colo_process_checkpoint(MigrationState
*s
)
39 qemu_mutex_lock_iothread();
41 qemu_mutex_unlock_iothread();
42 trace_colo_vm_state_change("stop", "run");
44 /* TODO: COLO checkpoint savevm loop */
48 void migrate_start_colo_process(MigrationState
*s
)
50 qemu_mutex_unlock_iothread();
51 migrate_set_state(&s
->state
, MIGRATION_STATUS_ACTIVE
,
52 MIGRATION_STATUS_COLO
);
53 colo_process_checkpoint(s
);
54 qemu_mutex_lock_iothread();
57 void *colo_process_incoming_thread(void *opaque
)
59 MigrationIncomingState
*mis
= opaque
;
61 migrate_set_state(&mis
->state
, MIGRATION_STATUS_ACTIVE
,
62 MIGRATION_STATUS_COLO
);
64 /* TODO: COLO checkpoint restore loop */
66 migration_incoming_exit_colo();