xref: /openbmc/qemu/include/migration/blocker.h (revision 235fe6d0)
1 /*
2  * QEMU migration blockers
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_BLOCKER_H
15 #define MIGRATION_BLOCKER_H
16 
17 /**
18  * @migrate_add_blocker - prevent migration from proceeding
19  *
20  * @reasonp - address of an error to be returned whenever migration is attempted
21  *
22  * @errp - [out] The reason (if any) we cannot block migration right now.
23  *
24  * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set.
25  *
26  * *@reasonp is freed and set to NULL if failure is returned.
27  * On success, the caller must not free @reasonp, except by
28  *   calling migrate_del_blocker.
29  */
30 int migrate_add_blocker(Error **reasonp, Error **errp);
31 
32 /**
33  * @migrate_add_blocker_internal - prevent migration from proceeding without
34  *                                 only-migrate implications
35  *
36  * @reasonp - address of an error to be returned whenever migration is attempted
37  *
38  * @errp - [out] The reason (if any) we cannot block migration right now.
39  *
40  * @returns - 0 on success, -EBUSY on failure, with errp set.
41  *
42  * Some of the migration blockers can be temporary (e.g., for a few seconds),
43  * so it shouldn't need to conflict with "-only-migratable".  For those cases,
44  * we can call this function rather than @migrate_add_blocker().
45  *
46  * *@reasonp is freed and set to NULL if failure is returned.
47  * On success, the caller must not free @reasonp, except by
48  *   calling migrate_del_blocker.
49  */
50 int migrate_add_blocker_internal(Error **reasonp, Error **errp);
51 
52 /**
53  * @migrate_del_blocker - remove a blocking error from migration and free it.
54  *
55  * @reasonp - address of the error blocking migration
56  *
57  * This function frees *@reasonp and sets it to NULL.
58  */
59 void migrate_del_blocker(Error **reasonp);
60 
61 #endif
62