* Peter Xu (peterx@redhat.com) wrote:
> Export a helper globally to check whether we're during a precopy.
>
> Signed-off-by: Peter Xu <peterx@redhat.com>
Can you change this to 'migration_in_precopy' to match the existing
'migration_in_postcopy'.
Dave
> ---
> include/migration/misc.h | 1 +
> migration/migration.c | 7 +++++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/include/migration/misc.h b/include/migration/misc.h
> index e338be8c30..b4f6bf7842 100644
> --- a/include/migration/misc.h
> +++ b/include/migration/misc.h
> @@ -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 *);
> diff --git a/migration/migration.c b/migration/migration.c
> index 187ac0410c..0082880279 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -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)
> {
> /*
> --
> 2.24.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK