Commit afe2df69 authored by Gerd Hoffmann's avatar Gerd Hoffmann

migration: add status query functions

Add migration_is_active and migration_has_failed functions
to query migration state.
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 952e849c
......@@ -372,11 +372,22 @@ void remove_migration_state_change_notifier(Notifier *notify)
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;
......
......@@ -76,7 +76,9 @@ void migrate_fd_connect(MigrationState *s);
void add_migration_state_change_notifier(Notifier *notify);
void remove_migration_state_change_notifier(Notifier *notify);
bool migration_is_active(MigrationState *);
bool migration_has_finished(MigrationState *);
bool migration_has_failed(MigrationState *);
uint64_t ram_bytes_remaining(void);
uint64_t ram_bytes_transferred(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment