thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 7 months ago
Clone

Blame SOURCES/kvm-migration-Allow-migrate-recover-to-run-multiple-time.patch

29b115
From fd6f516a94e635bc42e58448f314db575814a834 Mon Sep 17 00:00:00 2001
29b115
From: Peter Xu <peterx@redhat.com>
29b115
Date: Thu, 31 Mar 2022 11:08:45 -0400
29b115
Subject: [PATCH 18/18] migration: Allow migrate-recover to run multiple times
29b115
MIME-Version: 1.0
29b115
Content-Type: text/plain; charset=UTF-8
29b115
Content-Transfer-Encoding: 8bit
29b115
29b115
RH-Author: Peter Xu <peterx@redhat.com>
29b115
RH-MergeRequest: 104: migration: Allow migrate-recover to run multiple times
29b115
RH-Commit: [1/1] afd726e54c069ae800e2d01f34e768d6bac7dcb9 (peterx/qemu-kvm)
29b115
RH-Bugzilla: 2096143
29b115
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
29b115
RH-Acked-by: Hanna Reitz <hreitz@redhat.com>
29b115
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
29b115
29b115
Previously migration didn't have an easy way to cleanup the listening
29b115
transport, migrate recovery only allows to execute once.  That's done with a
29b115
trick flag in postcopy_recover_triggered.
29b115
29b115
Now the facility is already there.
29b115
29b115
Drop postcopy_recover_triggered and instead allows a new migrate-recover to
29b115
release the previous listener transport.
29b115
29b115
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
29b115
Signed-off-by: Peter Xu <peterx@redhat.com>
29b115
Message-Id: <20220331150857.74406-8-peterx@redhat.com>
29b115
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
29b115
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
29b115
(cherry picked from commit 08401c0426bc1a5ce4609afd1cda5dd39abbf9fa)
29b115
Signed-off-by: Peter Xu <peterx@redhat.com>
29b115
---
29b115
 migration/migration.c | 13 ++-----------
29b115
 migration/migration.h |  1 -
29b115
 migration/savevm.c    |  3 ---
29b115
 3 files changed, 2 insertions(+), 15 deletions(-)
29b115
29b115
diff --git a/migration/migration.c b/migration/migration.c
29b115
index 2a141bfaf3..8fb3eae910 100644
29b115
--- a/migration/migration.c
29b115
+++ b/migration/migration.c
29b115
@@ -2166,11 +2166,8 @@ void qmp_migrate_recover(const char *uri, Error **errp)
29b115
         return;
29b115
     }
29b115
 
29b115
-    if (qatomic_cmpxchg(&mis->postcopy_recover_triggered,
29b115
-                       false, true) == true) {
29b115
-        error_setg(errp, "Migrate recovery is triggered already");
29b115
-        return;
29b115
-    }
29b115
+    /* If there's an existing transport, release it */
29b115
+    migration_incoming_transport_cleanup(mis);
29b115
 
29b115
     /*
29b115
      * Note that this call will never start a real migration; it will
29b115
@@ -2178,12 +2175,6 @@ void qmp_migrate_recover(const char *uri, Error **errp)
29b115
      * to continue using that newly established channel.
29b115
      */
29b115
     qemu_start_incoming_migration(uri, errp);
29b115
-
29b115
-    /* Safe to dereference with the assert above */
29b115
-    if (*errp) {
29b115
-        /* Reset the flag so user could still retry */
29b115
-        qatomic_set(&mis->postcopy_recover_triggered, false);
29b115
-    }
29b115
 }
29b115
 
29b115
 void qmp_migrate_pause(Error **errp)
29b115
diff --git a/migration/migration.h b/migration/migration.h
29b115
index c2cabb8a14..fbc8690ec8 100644
29b115
--- a/migration/migration.h
29b115
+++ b/migration/migration.h
29b115
@@ -139,7 +139,6 @@ struct MigrationIncomingState {
29b115
     struct PostcopyBlocktimeContext *blocktime_ctx;
29b115
 
29b115
     /* notify PAUSED postcopy incoming migrations to try to continue */
29b115
-    bool postcopy_recover_triggered;
29b115
     QemuSemaphore postcopy_pause_sem_dst;
29b115
     QemuSemaphore postcopy_pause_sem_fault;
29b115
 
29b115
diff --git a/migration/savevm.c b/migration/savevm.c
29b115
index 02ed94c180..d9076897b8 100644
29b115
--- a/migration/savevm.c
29b115
+++ b/migration/savevm.c
29b115
@@ -2589,9 +2589,6 @@ static bool postcopy_pause_incoming(MigrationIncomingState *mis)
29b115
 
29b115
     assert(migrate_postcopy_ram());
29b115
 
29b115
-    /* Clear the triggered bit to allow one recovery */
29b115
-    mis->postcopy_recover_triggered = false;
29b115
-
29b115
     /*
29b115
      * Unregister yank with either from/to src would work, since ioc behind it
29b115
      * is the same
29b115
-- 
29b115
2.35.3
29b115