aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/migration/migration.c b/migration/migration.c
index dbc484c802..5ff7ba9d5c 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3691,6 +3691,17 @@ static void qemu_savevm_wait_unplug(MigrationState *s, int old_state,
qemu_savevm_state_guest_unplug_pending()) {
qemu_sem_timedwait(&s->wait_unplug_sem, 250);
}
+ if (s->state != MIGRATION_STATUS_WAIT_UNPLUG) {
+ int timeout = 120; /* 30 seconds */
+ /*
+ * migration has been canceled
+ * but as we have started an unplug we must wait the end
+ * to be able to plug back the card
+ */
+ while (timeout-- && qemu_savevm_state_guest_unplug_pending()) {
+ qemu_sem_timedwait(&s->wait_unplug_sem, 250);
+ }
+ }
migrate_set_state(&s->state, MIGRATION_STATUS_WAIT_UNPLUG, new_state);
} else {