diff mbox series

[13/17] migration: Store MigrationAddress in MigrationState

Message ID 20240125162528.7552-14-avihaih@nvidia.com (mailing list archive)
State New, archived
Headers show
Series migration: Add new migration channel connect and TLS upgrade APIs | expand

Commit Message

Avihai Horon Jan. 25, 2024, 4:25 p.m. UTC
This will be used in the new migration channel creation API in the
following patches.

Signed-off-by: Avihai Horon <avihaih@nvidia.com>
---
 migration/migration.h | 3 +++
 migration/migration.c | 6 ++++++
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/migration/migration.h b/migration/migration.h
index 17972dac34..dc370ab3e8 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -470,6 +470,9 @@  struct MigrationState {
     bool switchover_acked;
     /* Is this a rdma migration */
     bool rdma_migration;
+
+    /* The address used for this migration */
+    MigrationAddress *address;
 };
 
 void migrate_set_state(int *state, int old_state, int new_state);
diff --git a/migration/migration.c b/migration/migration.c
index d81d96eaa5..deaa79ff14 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1286,6 +1286,8 @@  static void migrate_fd_cleanup(MigrationState *s)
     s->hostname = NULL;
     json_writer_free(s->vmdesc);
     s->vmdesc = NULL;
+    qapi_free_MigrationAddress(s->address);
+    s->address = NULL;
 
     qemu_savevm_state_cleanup();
 
@@ -1974,6 +1976,8 @@  void qmp_migrate(const char *uri, bool has_channels,
         }
     }
 
+    s->address = QAPI_CLONE(MigrationAddress, addr);
+
     if (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) {
         SocketAddress *saddr = &addr->u.socket;
         if (saddr->type == SOCKET_ADDRESS_TYPE_INET ||
@@ -2005,6 +2009,8 @@  void qmp_migrate(const char *uri, bool has_channels,
         }
         migrate_fd_error(s, local_err);
         error_propagate(errp, local_err);
+        qapi_free_MigrationAddress(s->address);
+        s->address = NULL;
         return;
     }
 }