Commit 718c4dd4 authored by Zhimin Feng's avatar Zhimin Feng Committed by zhuyanting
Browse files

migration: Maybe VM is paused when migration is cancelled



If the migration is cancelled when it is in the completion phase,
the migration state is set to MIGRATION_STATUS_CANCELLING.
The VM maybe wait for the 'pause_sem' semaphore in migration_maybe_pause
function, so that VM always is paused.

Change-Id: Ib2f2f42ee1edbb14da269ee19ba1fe16dd363822
Reported-by: default avatarEuler Robot <euler.robot@huawei.com>
Signed-off-by: default avatarZhimin Feng <fengzhimin1@huawei.com>
Reviewed-by: default avatarJuan Quintela <quintela@redhat.com>
Signed-off-by: default avatarJuan Quintela <quintela@redhat.com>
parent 499afa5e
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -2731,6 +2731,13 @@ static int migration_maybe_pause(MigrationState *s,
        /* This block intentionally left blank */
    }

    /*
     * If the migration is cancelled when it is in the completion phase,
     * the migration state is set to MIGRATION_STATUS_CANCELLING.
     * So we don't need to wait a semaphore, otherwise we would always
     * wait for the 'pause_sem' semaphore.
     */
    if (s->state != MIGRATION_STATUS_CANCELLING) {
        qemu_mutex_unlock_iothread();
        migrate_set_state(&s->state, *current_active_state,
                          MIGRATION_STATUS_PRE_SWITCHOVER);
@@ -2739,6 +2746,7 @@ static int migration_maybe_pause(MigrationState *s,
                          new_state);
        *current_active_state = new_state;
        qemu_mutex_lock_iothread();
    }

    return s->state == new_state ? 0 : -EINVAL;
}