[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/18] migration: Add migration_incoming_transport_cleanup()
From: |
Dr. David Alan Gilbert (git) |
Subject: |
[PULL 16/18] migration: Add migration_incoming_transport_cleanup() |
Date: |
Wed, 2 Mar 2022 18:29:34 +0000 |
From: Peter Xu <peterx@redhat.com>
Add a helper to cleanup the transport listener.
When do it, we should also null-ify the cleanup hook and the data, then it's
even safe to call it multiple times.
Move the socket_address_list cleanup altogether, because that's a mirror of the
listener channels and only for the purpose of query-migrate. Hence when
someone wants to cleanup the listener transport, it should also want to cleanup
the socket list too, always.
No functional change intended.
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20220301083925.33483-15-peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/migration.c | 22 ++++++++++++++--------
migration/migration.h | 1 +
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 306e2ac60e..9cc344514b 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -267,6 +267,19 @@ MigrationIncomingState
*migration_incoming_get_current(void)
return current_incoming;
}
+void migration_incoming_transport_cleanup(MigrationIncomingState *mis)
+{
+ if (mis->socket_address_list) {
+ qapi_free_SocketAddressList(mis->socket_address_list);
+ mis->socket_address_list = NULL;
+ }
+
+ if (mis->transport_cleanup) {
+ mis->transport_cleanup(mis->transport_data);
+ mis->transport_data = mis->transport_cleanup = NULL;
+ }
+}
+
void migration_incoming_state_destroy(void)
{
struct MigrationIncomingState *mis = migration_incoming_get_current();
@@ -287,10 +300,8 @@ void migration_incoming_state_destroy(void)
g_array_free(mis->postcopy_remote_fds, TRUE);
mis->postcopy_remote_fds = NULL;
}
- if (mis->transport_cleanup) {
- mis->transport_cleanup(mis->transport_data);
- }
+ migration_incoming_transport_cleanup(mis);
qemu_event_reset(&mis->main_thread_load_event);
if (mis->page_requested) {
@@ -298,11 +309,6 @@ void migration_incoming_state_destroy(void)
mis->page_requested = NULL;
}
- if (mis->socket_address_list) {
- qapi_free_SocketAddressList(mis->socket_address_list);
- mis->socket_address_list = NULL;
- }
-
yank_unregister_instance(MIGRATION_YANK_INSTANCE);
}
diff --git a/migration/migration.h b/migration/migration.h
index d8b9850eae..2de861df01 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -166,6 +166,7 @@ struct MigrationIncomingState {
MigrationIncomingState *migration_incoming_get_current(void);
void migration_incoming_state_destroy(void);
+void migration_incoming_transport_cleanup(MigrationIncomingState *mis);
/*
* Functions to work with blocktime context
*/
--
2.35.1
- [PULL 07/18] migration: Dump sub-cmd name in loadvm_process_command tp, (continued)
- [PULL 07/18] migration: Dump sub-cmd name in loadvm_process_command tp, Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 05/18] qapi/monitor: allow VNC display id in set/expire_password, Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 06/18] migration/rdma: set the REUSEADDR option for destination, Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 09/18] migration: Tracepoint change in postcopy-run bottom half, Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 11/18] migration: Dump ramblock and offset too when non-same-page detected, Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 14/18] migration: Enlarge postcopy recovery to capture !-EIO too, Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 10/18] migration: Introduce postcopy channels on dest node, Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 13/18] migration: Move static var in ram_block_from_stream() into global, Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 12/18] migration: Add postcopy_thread_create(), Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 15/18] migration: postcopy_pause_fault_thread() never fails, Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 16/18] migration: Add migration_incoming_transport_cleanup(),
Dr. David Alan Gilbert (git) <=
- [PULL 17/18] tests: Pass in MigrateStart** into test_migrate_start(), Dr. David Alan Gilbert (git), 2022/03/02
- [PULL 18/18] migration: Remove load_state_old and minimum_version_id_old, Dr. David Alan Gilbert (git), 2022/03/02
- Re: [PULL 00/18] migration queue, Peter Maydell, 2022/03/03
- Re: [PULL 00/18] migration queue, Philippe Mathieu-Daudé, 2022/03/08
- Re: [PULL 00/18] migration queue, Dr. David Alan Gilbert, 2022/03/08
- Re: [PULL 00/18] migration queue, Peter Maydell, 2022/03/14
- Re: [PULL 00/18] migration queue, Daniel P . Berrangé, 2022/03/14
- Re: [PULL 00/18] migration queue, Peter Maydell, 2022/03/14
- Re: [PULL 00/18] migration queue, Daniel P . Berrangé, 2022/03/14
- Re: [PULL 00/18] migration queue, Dr. David Alan Gilbert, 2022/03/14