|
|
4841a6 |
From 02eab793d82cd3c82d31f1e1f34d16fcc30caf0e Mon Sep 17 00:00:00 2001
|
|
|
4841a6 |
From: Peter Xu <peterx@redhat.com>
|
|
|
4841a6 |
Date: Tue, 1 Mar 2022 16:39:14 +0800
|
|
|
4841a6 |
Subject: [PATCH 27/37] migration: Add migration_incoming_transport_cleanup()
|
|
|
4841a6 |
MIME-Version: 1.0
|
|
|
4841a6 |
Content-Type: text/plain; charset=UTF-8
|
|
|
4841a6 |
Content-Transfer-Encoding: 8bit
|
|
|
4841a6 |
|
|
|
4841a6 |
RH-Author: Peter Xu <peterx@redhat.com>
|
|
|
4841a6 |
RH-MergeRequest: 195: migration: Allow migrate-recover to run multiple times
|
|
|
4841a6 |
RH-Commit: [1/2] 57b2a9a165ee7cb2d01519bd54eb8dc4185815e0
|
|
|
4841a6 |
RH-Bugzilla: 2097652
|
|
|
4841a6 |
RH-Acked-by: Leonardo BrĂ¡s <leobras@redhat.com>
|
|
|
4841a6 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
4841a6 |
RH-Acked-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
4841a6 |
|
|
|
4841a6 |
Add a helper to cleanup the transport listener.
|
|
|
4841a6 |
|
|
|
4841a6 |
When do it, we should also null-ify the cleanup hook and the data, then it's
|
|
|
4841a6 |
even safe to call it multiple times.
|
|
|
4841a6 |
|
|
|
4841a6 |
Move the socket_address_list cleanup altogether, because that's a mirror of the
|
|
|
4841a6 |
listener channels and only for the purpose of query-migrate. Hence when
|
|
|
4841a6 |
someone wants to cleanup the listener transport, it should also want to cleanup
|
|
|
4841a6 |
the socket list too, always.
|
|
|
4841a6 |
|
|
|
4841a6 |
No functional change intended.
|
|
|
4841a6 |
|
|
|
4841a6 |
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
4841a6 |
Signed-off-by: Peter Xu <peterx@redhat.com>
|
|
|
4841a6 |
Message-Id: <20220301083925.33483-15-peterx@redhat.com>
|
|
|
4841a6 |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
4841a6 |
(cherry picked from commit e031149c78489413038e934eec9f54ac699cf322)
|
|
|
4841a6 |
Signed-off-by: Peter Xu <peterx@redhat.com>
|
|
|
4841a6 |
---
|
|
|
4841a6 |
migration/migration.c | 22 ++++++++++++++--------
|
|
|
4841a6 |
migration/migration.h | 1 +
|
|
|
4841a6 |
2 files changed, 15 insertions(+), 8 deletions(-)
|
|
|
4841a6 |
|
|
|
4841a6 |
diff --git a/migration/migration.c b/migration/migration.c
|
|
|
4841a6 |
index c8aa55d2fe..b787a36789 100644
|
|
|
4841a6 |
--- a/migration/migration.c
|
|
|
4841a6 |
+++ b/migration/migration.c
|
|
|
4841a6 |
@@ -263,6 +263,19 @@ MigrationIncomingState *migration_incoming_get_current(void)
|
|
|
4841a6 |
return current_incoming;
|
|
|
4841a6 |
}
|
|
|
4841a6 |
|
|
|
4841a6 |
+void migration_incoming_transport_cleanup(MigrationIncomingState *mis)
|
|
|
4841a6 |
+{
|
|
|
4841a6 |
+ if (mis->socket_address_list) {
|
|
|
4841a6 |
+ qapi_free_SocketAddressList(mis->socket_address_list);
|
|
|
4841a6 |
+ mis->socket_address_list = NULL;
|
|
|
4841a6 |
+ }
|
|
|
4841a6 |
+
|
|
|
4841a6 |
+ if (mis->transport_cleanup) {
|
|
|
4841a6 |
+ mis->transport_cleanup(mis->transport_data);
|
|
|
4841a6 |
+ mis->transport_data = mis->transport_cleanup = NULL;
|
|
|
4841a6 |
+ }
|
|
|
4841a6 |
+}
|
|
|
4841a6 |
+
|
|
|
4841a6 |
void migration_incoming_state_destroy(void)
|
|
|
4841a6 |
{
|
|
|
4841a6 |
struct MigrationIncomingState *mis = migration_incoming_get_current();
|
|
|
4841a6 |
@@ -283,10 +296,8 @@ void migration_incoming_state_destroy(void)
|
|
|
4841a6 |
g_array_free(mis->postcopy_remote_fds, TRUE);
|
|
|
4841a6 |
mis->postcopy_remote_fds = NULL;
|
|
|
4841a6 |
}
|
|
|
4841a6 |
- if (mis->transport_cleanup) {
|
|
|
4841a6 |
- mis->transport_cleanup(mis->transport_data);
|
|
|
4841a6 |
- }
|
|
|
4841a6 |
|
|
|
4841a6 |
+ migration_incoming_transport_cleanup(mis);
|
|
|
4841a6 |
qemu_event_reset(&mis->main_thread_load_event);
|
|
|
4841a6 |
|
|
|
4841a6 |
if (mis->page_requested) {
|
|
|
4841a6 |
@@ -294,11 +305,6 @@ void migration_incoming_state_destroy(void)
|
|
|
4841a6 |
mis->page_requested = NULL;
|
|
|
4841a6 |
}
|
|
|
4841a6 |
|
|
|
4841a6 |
- if (mis->socket_address_list) {
|
|
|
4841a6 |
- qapi_free_SocketAddressList(mis->socket_address_list);
|
|
|
4841a6 |
- mis->socket_address_list = NULL;
|
|
|
4841a6 |
- }
|
|
|
4841a6 |
-
|
|
|
4841a6 |
yank_unregister_instance(MIGRATION_YANK_INSTANCE);
|
|
|
4841a6 |
}
|
|
|
4841a6 |
|
|
|
4841a6 |
diff --git a/migration/migration.h b/migration/migration.h
|
|
|
4841a6 |
index 9396b7e90a..243898e3be 100644
|
|
|
4841a6 |
--- a/migration/migration.h
|
|
|
4841a6 |
+++ b/migration/migration.h
|
|
|
4841a6 |
@@ -130,6 +130,7 @@ struct MigrationIncomingState {
|
|
|
4841a6 |
|
|
|
4841a6 |
MigrationIncomingState *migration_incoming_get_current(void);
|
|
|
4841a6 |
void migration_incoming_state_destroy(void);
|
|
|
4841a6 |
+void migration_incoming_transport_cleanup(MigrationIncomingState *mis);
|
|
|
4841a6 |
/*
|
|
|
4841a6 |
* Functions to work with blocktime context
|
|
|
4841a6 |
*/
|
|
|
4841a6 |
--
|
|
|
4841a6 |
2.35.3
|
|
|
4841a6 |
|