From b172ed840eb1773e7ec9fbd51747ec267d6c54c5 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Wed, 19 Oct 2011 23:47:37 +0200 Subject: [PATCH 02/18] migration: simplify state assignmente RH-Author: Juan Quintela Message-id: <74a0d86ffc41be8cebb7182534735622320dbdd8.1319066770.git.quintela@redhat.com> Patchwork-id: 34426 O-Subject: [PATCH qemu-kvm RHEL-6.2 02/16] migration: simplify state assignmente Bugzilla: 669581 RH-Acked-by: Amit Shah RH-Acked-by: Markus Armbruster RH-Acked-by: Orit Wasserman Once there, make sure that if we already know that there is one error, just call migration_fd_cleanup() with the ERROR state. Signed-off-by: Juan Quintela Reviewed-by: Anthony Liguori Conflicts: migration.c --- migration.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) Signed-off-by: Michal Novotny --- migration.c | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) diff --git a/migration.c b/migration.c index a62dcb7..d40005d 100644 --- a/migration.c +++ b/migration.c @@ -391,7 +391,6 @@ void migrate_fd_put_ready(void *opaque) DPRINTF("iterate\n"); if (qemu_savevm_state_iterate(s->mon, s->file) == 1) { - int state; int old_vm_running = runstate_is_running(); DPRINTF("done iterating\n"); @@ -403,11 +402,8 @@ void migrate_fd_put_ready(void *opaque) if (old_vm_running) { vm_start(); } - state = MIG_STATE_ERROR; - } else { - state = MIG_STATE_COMPLETED; + s->state = MIG_STATE_ERROR; } - s->state = state; STOP_MIGRATION_CLOCK(); DPRINTF("ended after %lu milliseconds\n", stop); @@ -415,8 +411,10 @@ void migrate_fd_put_ready(void *opaque) if (old_vm_running) { vm_start(); } + s->state = MIG_STATE_ERROR; } - if (state == MIG_STATE_COMPLETED) { + if (s->state == MIG_STATE_ACTIVE) { + s->state = MIG_STATE_COMPLETED; runstate_set(RUN_STATE_POSTMIGRATE); } notifier_list_notify(&migration_state_notifiers); -- 1.7.4.4