diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> | 2023-05-17 15:37:51 +0300 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2023-06-02 01:03:19 +0200 |
commit | f4584076fc318bb4ac762e3c09ff3544938fed5b (patch) | |
tree | 2edc3afdd72f63bdfdc5bff6d426d2e6919e9516 /migration/migration.c | |
parent | e76005a081d08d1e42d98811fba983c59b3f736b (diff) | |
download | qemu-f4584076fc318bb4ac762e3c09ff3544938fed5b.zip qemu-f4584076fc318bb4ac762e3c09ff3544938fed5b.tar.gz qemu-f4584076fc318bb4ac762e3c09ff3544938fed5b.tar.bz2 |
migration: switch from .vm_was_running to .vm_old_state
No logic change here, only refactoring. That's a preparation for next
commit where we finally restore the stopped vm state on migration
failure or cancellation.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20230517123752.21615-5-vsementsov@yandex-team.ru>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration/migration.c')
-rw-r--r-- | migration/migration.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/migration/migration.c b/migration/migration.c index c75d5aa..033162c 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -1402,7 +1402,7 @@ void migrate_init(MigrationState *s) s->start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); s->total_time = 0; - s->vm_was_running = false; + s->vm_old_state = -1; s->iteration_initial_bytes = 0; s->threshold_size = 0; } @@ -2287,7 +2287,8 @@ static void migration_completion(MigrationState *s) qemu_mutex_lock_iothread(); s->downtime_start = qemu_clock_get_ms(QEMU_CLOCK_REALTIME); qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); - s->vm_was_running = runstate_is_running(); + + s->vm_old_state = runstate_get(); global_state_store(); ret = vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); @@ -2760,12 +2761,12 @@ static void migration_iteration_finish(MigrationState *s) case MIGRATION_STATUS_COLO: assert(migrate_colo()); migrate_start_colo_process(s); - s->vm_was_running = true; + s->vm_old_state = RUN_STATE_RUNNING; /* Fallthrough */ case MIGRATION_STATUS_FAILED: case MIGRATION_STATUS_CANCELLED: case MIGRATION_STATUS_CANCELLING: - if (s->vm_was_running) { + if (s->vm_old_state == RUN_STATE_RUNNING) { if (!runstate_check(RUN_STATE_SHUTDOWN)) { vm_start(); } @@ -3085,7 +3086,7 @@ static void *bg_migration_thread(void *opaque) * transition in vm_stop_force_state() we need to wakeup it up. */ qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, NULL); - s->vm_was_running = runstate_is_running(); + s->vm_old_state = runstate_get(); global_state_store(); /* Forcibly stop VM before saving state of vCPUs and devices */ |