Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Wed, 20 Jul 2016 17:16:31 +0400
Subject: [PATCH] Call migrate_end_complete() after falling back to switch-host
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Eventually, during a seamless migration, qemu may finish to migrate
before the spice client even finished to connect all channels to
destination and informed the server. In this case,
main_channel_client_migrate_src_complete() will fall back to
switch-host method, and reds_mig_fill_wait_disconnect() is called to
complete the migration (disconnecting all channels).

reds_mig_cleanup() is called when all channels are disconnected, but
reds->mig_wait_connect is still TRUE, and it will call
migrate_connect_complete() instead of the expected
migrate_end_complete(). Setting reds->mig_wait_connect to FALSE when
reds_mig_fill_wait_disconnect() solves the issue.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1352836

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 server/reds.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/server/reds.c b/server/reds.c
index e7e4090..9e1d5e7 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3500,6 +3500,7 @@ static void reds_mig_fill_wait_disconnect(void)
         wait_client->client = client;
         ring_add(&reds->mig_wait_disconnect_clients, &wait_client->link);
     }
+    reds->mig_wait_connect = FALSE;
     reds->mig_wait_disconnect = TRUE;
     core->timer_start(reds->mig_timer, MIGRATE_TIMEOUT);
 }