| 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 | #include "qapi/qapi-types-migration.h" |
| 18 | |
| 19 | /** |
| 20 | * @migrate_add_blocker - prevent all modes of migration from proceeding |
| 21 | * |
| 22 | * @reasonp - address of an error to be returned whenever migration is attempted |
| 23 | * |
| 24 | * @errp - [out] The reason (if any) we cannot block migration right now. |
| 25 | * |
| 26 | * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set. |
| 27 | * |
| 28 | * *@reasonp is freed and set to NULL if failure is returned. |
| 29 | * On success, the caller must not free @reasonp, except by |
| 30 | * calling migrate_del_blocker. |
| 31 | */ |
| 32 | int migrate_add_blocker(Error **reasonp, Error **errp); |
| 33 | |
| 34 | /** |
| 35 | * @migrate_add_blocker_internal - prevent all modes of migration from |
| 36 | * proceeding, but ignore -only-migratable |
| 37 | * |
| 38 | * @reasonp - address of an error to be returned whenever migration is attempted |
| 39 | * |
| 40 | * @errp - [out] The reason (if any) we cannot block migration right now. |
| 41 | * |
| 42 | * @returns - 0 on success, -EBUSY on failure, with errp set. |
| 43 | * |
| 44 | * Some of the migration blockers can be temporary (e.g., for a few seconds), |
| 45 | * so it shouldn't need to conflict with "-only-migratable". For those cases, |
| 46 | * we can call this function rather than @migrate_add_blocker(). |
| 47 | * |
| 48 | * *@reasonp is freed and set to NULL if failure is returned. |
| 49 | * On success, the caller must not free @reasonp, except by |
| 50 | * calling migrate_del_blocker. |
| 51 | */ |
| 52 | int migrate_add_blocker_internal(Error **reasonp, Error **errp); |
| 53 | |
| 54 | /** |
| 55 | * @migrate_del_blocker - remove a migration blocker from all modes and free it. |
| 56 | * |
| 57 | * @reasonp - address of the error blocking migration |
| 58 | * |
| 59 | * This function frees *@reasonp and sets it to NULL. |
| 60 | */ |
| 61 | void migrate_del_blocker(Error **reasonp); |
| 62 | |
| 63 | /** |
| 64 | * @migrate_add_blocker_normal - prevent normal migration mode from proceeding |
| 65 | * |
| 66 | * @reasonp - address of an error to be returned whenever migration is attempted |
| 67 | * |
| 68 | * @errp - [out] The reason (if any) we cannot block migration right now. |
| 69 | * |
| 70 | * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set. |
| 71 | * |
| 72 | * *@reasonp is freed and set to NULL if failure is returned. |
| 73 | * On success, the caller must not free @reasonp, except by |
| 74 | * calling migrate_del_blocker. |
| 75 | */ |
| 76 | int migrate_add_blocker_normal(Error **reasonp, Error **errp); |
| 77 | |
| 78 | /** |
| 79 | * @migrate_add_blocker_modes - prevent some modes of migration from proceeding |
| 80 | * |
| 81 | * @reasonp - address of an error to be returned whenever migration is attempted |
| 82 | * |
| 83 | * @modes - the migration modes to be blocked, a bit set of MigMode |
| 84 | * |
| 85 | * @errp - [out] The reason (if any) we cannot block migration right now. |
| 86 | * |
| 87 | * @returns - 0 on success, -EBUSY/-EACCES on failure, with errp set. |
| 88 | * |
| 89 | * *@reasonp is freed and set to NULL if failure is returned. |
| 90 | * On success, the caller must not free *@reasonp before the blocker is removed. |
| 91 | */ |
| 92 | int migrate_add_blocker_modes(Error **reasonp, unsigned modes, Error **errp); |
| 93 | |
| 94 | #endif |