diff mbox

[1/7] migration: simplify state assignmente

Message ID 9cb4acdb8b9d8654f3f6de63d550db0207d8b1af.1316524908.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela Sept. 20, 2011, 1:24 p.m. UTC
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 <quintela@redhat.com>
---
 migration.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/migration.c b/migration.c
index f5959b4..9a93e3b 100644
--- a/migration.c
+++ b/migration.c
@@ -370,7 +370,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 = vm_running;

         DPRINTF("done iterating\n");
@@ -380,17 +379,17 @@  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;
         }
         if (migrate_fd_cleanup(s) < 0) {
             if (old_vm_running) {
                 vm_start();
             }
-            state = MIG_STATE_ERROR;
+            s->state = MIG_STATE_ERROR;
+        }
+        if (s->state == MIG_STATE_ACTIVE) {
+            s->state = MIG_STATE_COMPLETED;
         }
-        s->state = state;
         notifier_list_notify(&migration_state_notifiers, NULL);
     }
 }