summary refs log tree commit diff stats
path: root/migration
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2016-02-22 17:17:32 +0000
committerGerd Hoffmann <kraxel@redhat.com>2016-02-23 12:05:02 +0100
commitb82fc321bf02aaceea0beb4dfabb4ca86a9a5ff6 (patch)
tree1fb20198c649bbfba261fc60eec192e69fcf03d1 /migration
parent22672a3798f1d705c2b1e14a246efd4a8e4bc661 (diff)
downloadfocaccia-qemu-b82fc321bf02aaceea0beb4dfabb4ca86a9a5ff6.tar.gz
focaccia-qemu-b82fc321bf02aaceea0beb4dfabb4ca86a9a5ff6.zip
Postcopy+spice: Pass spice migration data earlier
Spice hooks the migration status changes to figure out when to
transmit information to the new spice server; but the migration
status in postcopy doesn't quite fit - the destination starts
running before the end of the source migration.

It's not a case of hanging off the migration status change to
postcopy-active either, since that happens before we stop the
guest CPU.

Fix it by sending a notify just after sending the device state,
and adding a flag that can be tested by the notify receiver.

Symptom:
   spice handover doesn't work with the error:
   red_worker.c:11540:display_channel_wait_for_migrate_data: timeout

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Message-id: 1456161452-25318-1-git-send-email-dgilbert@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/migration/migration.c b/migration/migration.c
index a64cfcdb07..fc5e50b0be 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -905,6 +905,11 @@ bool migration_in_postcopy(MigrationState *s)
     return (s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
 }
 
+bool migration_in_postcopy_after_devices(MigrationState *s)
+{
+    return migration_in_postcopy(s) && s->postcopy_after_devices;
+}
+
 MigrationState *migrate_init(const MigrationParams *params)
 {
     MigrationState *s = migrate_get_current();
@@ -930,6 +935,7 @@ MigrationState *migrate_init(const MigrationParams *params)
     s->setup_time = 0;
     s->dirty_sync_count = 0;
     s->start_postcopy = false;
+    s->postcopy_after_devices = false;
     s->migration_thread_running = false;
     s->last_req_rb = NULL;
 
@@ -1489,6 +1495,14 @@ static int postcopy_start(MigrationState *ms, bool *old_vm_running)
         goto fail_closefb;
     }
     qemu_fclose(fb);
+
+    /* Send a notify to give a chance for anything that needs to happen
+     * at the transition to postcopy and after the device state; in particular
+     * spice needs to trigger a transition now
+     */
+    ms->postcopy_after_devices = true;
+    notifier_list_notify(&migration_state_notifiers, ms);
+
     ms->downtime =  qemu_clock_get_ms(QEMU_CLOCK_REALTIME) - time_at_stop;
 
     qemu_mutex_unlock_iothread();