Blame SOURCES/kvm-migration-allow-cancel-to-unpause.patch

9bac43
From a25e94a891b4633f6039e39f5c63041f4a0b6722 Mon Sep 17 00:00:00 2001
9bac43
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
9bac43
Date: Wed, 25 Oct 2017 18:28:37 +0200
9bac43
Subject: [PATCH 18/19] migration: allow cancel to unpause
9bac43
9bac43
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
9bac43
Message-id: <20171025182838.31829-7-dgilbert@redhat.com>
9bac43
Patchwork-id: 77438
9bac43
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH 6/7] migration: allow cancel to unpause
9bac43
Bugzilla: 1497120
9bac43
RH-Acked-by: Peter Xu <peterx@redhat.com>
9bac43
RH-Acked-by: Juan Quintela <quintela@redhat.com>
9bac43
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
9bac43
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
9bac43
9bac43
If a migration_cancel is issued during the new paused state,
9bac43
kick the pause_sem to get to unpause so it can cancel.
9bac43
9bac43
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9bac43
Reviewed-by: Peter Xu <peterx@redhat.com>
9bac43
Reviewed-by: Juan Quintela <quintela@redhat.com>
9bac43
Signed-off-by: Juan Quintela <quintela@redhat.com>
9bac43
(cherry picked from commit a7b36b486dd58d8f44f788a2a2efa6a4fa3b1223)
9bac43
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9bac43
---
9bac43
 migration/migration.c | 4 ++++
9bac43
 1 file changed, 4 insertions(+)
9bac43
9bac43
diff --git a/migration/migration.c b/migration/migration.c
9bac43
index 3a1dabb..3f23ed0 100644
9bac43
--- a/migration/migration.c
9bac43
+++ b/migration/migration.c
9bac43
@@ -1027,6 +1027,10 @@ static void migrate_fd_cancel(MigrationState *s)
9bac43
         if (!migration_is_setup_or_active(old_state)) {
9bac43
             break;
9bac43
         }
9bac43
+        /* If the migration is paused, kick it out of the pause */
9bac43
+        if (old_state == MIGRATION_STATUS_PRE_SWITCHOVER) {
9bac43
+            qemu_sem_post(&s->pause_sem);
9bac43
+        }
9bac43
         migrate_set_state(&s->state, old_state, MIGRATION_STATUS_CANCELLING);
9bac43
     } while (s->state != MIGRATION_STATUS_CANCELLING);
9bac43
 
9bac43
-- 
9bac43
1.8.3.1
9bac43