thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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