migration: detect error before sleeping
authorPaolo Bonzini <pbonzini@redhat.com>
Fri, 22 Feb 2013 16:36:33 +0000 (17:36 +0100)
committerJuan Quintela <quintela@redhat.com>
Mon, 11 Mar 2013 12:32:02 +0000 (13:32 +0100)
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
migration.c

index 612ffa7438e8855de6370ba84db01cf87654ea03..414e0f9023aa6e4a8bf433ad8aad691cece33bc7 100644 (file)
@@ -657,6 +657,10 @@ static void *migration_thread(void *opaque)
             }
         }
 
+        if (qemu_file_get_error(s->file)) {
+            migrate_finish_set_state(s, MIG_STATE_ERROR);
+            break;
+        }
         current_time = qemu_get_clock_ms(rt_clock);
         if (current_time >= initial_time + BUFFER_DELAY) {
             uint64_t transferred_bytes = s->bytes_xfer;
@@ -682,9 +686,6 @@ static void *migration_thread(void *opaque)
             g_usleep((initial_time + BUFFER_DELAY - current_time)*1000);
             sleep_time += qemu_get_clock_ms(rt_clock) - current_time;
         }
-        if (qemu_file_get_error(s->file)) {
-            migrate_finish_set_state(s, MIG_STATE_ERROR);
-        }
     }
 
     qemu_mutex_lock_iothread();