aboutsummaryrefslogtreecommitdiff
path: root/migration/migration.c
diff options
context:
space:
mode:
authorSteve Sistare <steven.sistare@oracle.com>2024-03-11 10:48:51 -0700
committerPeter Xu <peterx@redhat.com>2024-03-11 16:28:59 -0400
commitaeaafb1e59f81f5cc715e656dac23f3fe5db3faa (patch)
tree52d7e03dafa6805bd57ee0c3979815ef1075feac /migration/migration.c
parent3a6813b68cf21a366522564f83f885bf2657dcc8 (diff)
migration: export migration_is_running
Delete the MigrationState parameter from migration_is_running and move it to the public API in misc.h. Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Link: https://lore.kernel.org/r/1710179338-294359-5-git-send-email-steven.sistare@oracle.com Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration/migration.c')
-rw-r--r--migration/migration.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 17859cbaee..546ba86c63 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1103,9 +1103,11 @@ bool migration_is_setup_or_active(void)
}
}
-bool migration_is_running(int state)
+bool migration_is_running(void)
{
- switch (state) {
+ MigrationState *s = current_migration;
+
+ switch (s->state) {
case MIGRATION_STATUS_ACTIVE:
case MIGRATION_STATUS_POSTCOPY_ACTIVE:
case MIGRATION_STATUS_POSTCOPY_PAUSED:
@@ -1477,7 +1479,7 @@ static void migrate_fd_cancel(MigrationState *s)
do {
old_state = s->state;
- if (!migration_is_running(old_state)) {
+ if (!migration_is_running()) {
break;
}
/* If the migration is paused, kick it out of the pause */
@@ -1962,7 +1964,7 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
return true;
}
- if (migration_is_running(s->state)) {
+ if (migration_is_running()) {
error_setg(errp, QERR_MIGRATION_ACTIVE);
return false;
}