]>
Commit | Line | Data |
---|---|---|
35a6ed4f 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" | |
0b827d5e | 14 | #include "sysemu/sysemu.h" |
35a6ed4f | 15 | #include "migration/colo.h" |
0b827d5e | 16 | #include "trace.h" |
35a6ed4f HZ |
17 | |
18 | bool colo_supported(void) | |
19 | { | |
20 | return false; | |
21 | } | |
0b827d5e HZ |
22 | |
23 | bool migration_in_colo_state(void) | |
24 | { | |
25 | MigrationState *s = migrate_get_current(); | |
26 | ||
27 | return (s->state == MIGRATION_STATUS_COLO); | |
28 | } | |
29 | ||
25d0c16f HZ |
30 | bool migration_incoming_in_colo_state(void) |
31 | { | |
32 | MigrationIncomingState *mis = migration_incoming_get_current(); | |
33 | ||
34 | return mis && (mis->state == MIGRATION_STATUS_COLO); | |
35 | } | |
36 | ||
0b827d5e HZ |
37 | static void colo_process_checkpoint(MigrationState *s) |
38 | { | |
39 | qemu_mutex_lock_iothread(); | |
40 | vm_start(); | |
41 | qemu_mutex_unlock_iothread(); | |
42 | trace_colo_vm_state_change("stop", "run"); | |
43 | ||
44 | /* TODO: COLO checkpoint savevm loop */ | |
45 | ||
46 | } | |
47 | ||
48 | void migrate_start_colo_process(MigrationState *s) | |
49 | { | |
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(); | |
55 | } | |
25d0c16f HZ |
56 | |
57 | void *colo_process_incoming_thread(void *opaque) | |
58 | { | |
59 | MigrationIncomingState *mis = opaque; | |
60 | ||
61 | migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, | |
62 | MIGRATION_STATUS_COLO); | |
63 | ||
64 | /* TODO: COLO checkpoint restore loop */ | |
65 | ||
66 | migration_incoming_exit_colo(); | |
67 | ||
68 | return NULL; | |
69 | } |