]>
Commit | Line | Data |
---|---|---|
f2a8f0a6 JQ |
1 | /* |
2 | * QEMU migration vmstate registration | |
3 | * | |
4 | * Copyright IBM, Corp. 2008 | |
5 | * | |
6 | * Authors: | |
7 | * Anthony Liguori <aliguori@us.ibm.com> | |
8 | * | |
9 | * This work is licensed under the terms of the GNU GPL, version 2. See | |
10 | * the COPYING file in the top-level directory. | |
11 | * | |
12 | */ | |
13 | ||
14 | #ifndef MIGRATION_REGISTER_H | |
15 | #define MIGRATION_REGISTER_H | |
16 | ||
f2a8f0a6 JQ |
17 | typedef struct SaveVMHandlers { |
18 | /* This runs inside the iothread lock. */ | |
19 | SaveStateHandler *save_state; | |
20 | ||
70f794fc | 21 | void (*save_cleanup)(void *opaque); |
f2a8f0a6 JQ |
22 | int (*save_live_complete_postcopy)(QEMUFile *f, void *opaque); |
23 | int (*save_live_complete_precopy)(QEMUFile *f, void *opaque); | |
24 | ||
25 | /* This runs both outside and inside the iothread lock. */ | |
26 | bool (*is_active)(void *opaque); | |
c6467627 | 27 | bool (*has_postcopy)(void *opaque); |
f2a8f0a6 JQ |
28 | |
29 | /* This runs outside the iothread lock in the migration case, and | |
30 | * within the lock in the savevm case. The callback had better only | |
31 | * use data that is local to the migration thread or protected | |
32 | * by other locks. | |
33 | */ | |
34 | int (*save_live_iterate)(QEMUFile *f, void *opaque); | |
35 | ||
36 | /* This runs outside the iothread lock! */ | |
9907e842 | 37 | int (*save_setup)(QEMUFile *f, void *opaque); |
f2a8f0a6 JQ |
38 | void (*save_live_pending)(QEMUFile *f, void *opaque, |
39 | uint64_t threshold_size, | |
47995026 VSO |
40 | uint64_t *res_precopy_only, |
41 | uint64_t *res_compatible, | |
42 | uint64_t *res_postcopy_only); | |
43 | /* Note for save_live_pending: | |
44 | * - res_precopy_only is for data which must be migrated in precopy phase | |
45 | * or in stopped state, in other words - before target vm start | |
46 | * - res_compatible is for data which may be migrated in any phase | |
47 | * - res_postcopy_only is for data which must be migrated in postcopy phase | |
48 | * or in stopped state, in other words - after source vm stop | |
49 | * | |
50 | * Sum of res_postcopy_only, res_compatible and res_postcopy_only is the | |
51 | * whole amount of pending data. | |
52 | */ | |
53 | ||
54 | ||
f2a8f0a6 | 55 | LoadStateHandler *load_state; |
acb5ea86 JQ |
56 | int (*load_setup)(QEMUFile *f, void *opaque); |
57 | int (*load_cleanup)(void *opaque); | |
f2a8f0a6 JQ |
58 | } SaveVMHandlers; |
59 | ||
60 | int register_savevm_live(DeviceState *dev, | |
61 | const char *idstr, | |
62 | int instance_id, | |
63 | int version_id, | |
64 | SaveVMHandlers *ops, | |
65 | void *opaque); | |
66 | ||
67 | void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque); | |
68 | ||
69 | #endif |