Skip to content

Commit

Permalink
migration: Add cleanup hook for inwards migration
Browse files Browse the repository at this point in the history
Add a cleanup hook for incoming migration that gets called
at the end as a way for a transport to allow cleanup.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Daniel P. Berrangé <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
  • Loading branch information
dagrh committed Jun 8, 2021
1 parent 5b6116d commit 1df6ddb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions migration/migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ 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);
}

qemu_event_reset(&mis->main_thread_load_event);

Expand Down
4 changes: 4 additions & 0 deletions migration/migration.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ struct PostcopyBlocktimeContext;
struct MigrationIncomingState {
QEMUFile *from_src_file;

/* A hook to allow cleanup at the end of incoming migration */
void *transport_data;
void (*transport_cleanup)(void *data);

/*
* Free at the start of the main state load, set as the main thread finishes
* loading state.
Expand Down

0 comments on commit 1df6ddb

Please sign in to comment.