Signed-off-by: Juan Quintela <quint...@redhat.com>
---
 migration.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/migration.c b/migration.c
index abb99ea..740483d 100644
--- a/migration.c
+++ b/migration.c
@@ -373,23 +373,22 @@ static void migrate_fd_put_ready(void *opaque)
         DPRINTF("done iterating\n");
         vm_stop(RSTATE_PRE_MIGRATE);

-        if ((qemu_savevm_state_complete(s->mon, s->file)) < 0) {
-            if (old_vm_running) {
-                vm_start();
+        if (qemu_savevm_state_complete(s->mon, s->file) < 0) {
+            migrate_fd_error(s);
+        } else {
+            if (migrate_fd_cleanup(s) < 0) {
+                migrate_fd_error(s);
+            } else {
+                s->state = MIG_STATE_COMPLETED;
+                runstate_set(RSTATE_POST_MIGRATE);
+                notifier_list_notify(&migration_state_notifiers, NULL);
             }
-            s->state = MIG_STATE_ERROR;
         }
-        if (migrate_fd_cleanup(s) < 0) {
+        if (s->get_status(s) != MIG_STATE_COMPLETED) {
             if (old_vm_running) {
                 vm_start();
             }
-            s->state = MIG_STATE_ERROR;
         }
-        if (s->state == MIG_STATE_ACTIVE) {
-            s->state = MIG_STATE_COMPLETED;
-            runstate_set(RSTATE_POST_MIGRATE);
-        }
-        notifier_list_notify(&migration_state_notifiers, NULL);
     }
 }

-- 
1.7.6.2


Reply via email to