migration: migration_file_set_error

Define and export migration_file_set_error to eliminate a dependency
on MigrationState.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Link: https://lore.kernel.org/r/1710179338-294359-9-git-send-email-steven.sistare@oracle.com
Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
Steve Sistare 2024-03-11 10:48:55 -07:00 committed by Peter Xu
parent 9bb630c6ee
commit 20c64c8a51
4 changed files with 17 additions and 16 deletions

View file

@ -3038,6 +3038,17 @@ static MigThrError postcopy_pause(MigrationState *s)
}
}
void migration_file_set_error(int err)
{
MigrationState *s = current_migration;
WITH_QEMU_LOCK_GUARD(&s->qemu_file_lock) {
if (s->to_dst_file) {
qemu_file_set_error(s->to_dst_file, err);
}
}
}
static MigThrError migration_detect_error(MigrationState *s)
{
int ret;