migration: add status query functions
Add migration_is_active and migration_has_failed functions
to query migration state.
Signed-off-by: Gerd Hoffmann <[email protected]>
diff --git a/migration.c b/migration.c
index bdca72e..d693567 100644
--- a/migration.c
+++ b/migration.c
@@ -372,11 +372,22 @@
notifier_list_remove(&migration_state_notifiers, notify);
}
+bool migration_is_active(MigrationState *s)
+{
+ return s->state == MIG_STATE_ACTIVE;
+}
+
bool migration_has_finished(MigrationState *s)
{
return s->state == MIG_STATE_COMPLETED;
}
+bool migration_has_failed(MigrationState *s)
+{
+ return (s->state == MIG_STATE_CANCELLED ||
+ s->state == MIG_STATE_ERROR);
+}
+
void migrate_fd_connect(MigrationState *s)
{
int ret;