@@ -61,6 +61,7 @@ void migration_shutdown(void);
void qemu_start_incoming_migration(const char *uri, Error **errp);
bool migration_is_idle(void);
bool migration_is_active(MigrationState *);
+bool migration_is_precopy(void);
void add_migration_state_change_notifier(Notifier *notify);
void remove_migration_state_change_notifier(Notifier *notify);
bool migration_in_setup(MigrationState *);
@@ -1795,6 +1795,13 @@ bool migration_is_active(MigrationState *s)
s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
}
+bool migration_is_precopy(void)
+{
+ MigrationState *s = migrate_get_current();
+
+ return s && s->state == MIGRATION_STATUS_ACTIVE;
+}
+
void migrate_init(MigrationState *s)
{
/*
Export a helper globally to check whether we're during a precopy. Signed-off-by: Peter Xu <peterx@redhat.com> --- include/migration/misc.h | 1 + migration/migration.c | 7 +++++++ 2 files changed, 8 insertions(+)