Skip to content

Commit

Permalink
migration: Create migrate_rdma()
Browse files Browse the repository at this point in the history
Helper to say if we are doing a migration over rdma.

Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231011203527.9061-2-quintela@redhat.com>
  • Loading branch information
Juan Quintela committed Oct 17, 2023
1 parent d4f3448 commit 27fd25b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions migration/migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,7 @@ int migrate_init(MigrationState *s, Error **errp)
s->iteration_initial_bytes = 0;
s->threshold_size = 0;
s->switchover_acked = false;
s->rdma_migration = false;
/*
* set mig_stats compression_counters memory to zero for a
* new migration
Expand Down
2 changes: 2 additions & 0 deletions migration/migration.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ struct MigrationState {
* switchover has been received.
*/
bool switchover_acked;
/* Is this a rdma migration */
bool rdma_migration;
};

void migrate_set_state(int *state, int old_state, int new_state);
Expand Down
7 changes: 7 additions & 0 deletions migration/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,13 @@ bool migrate_postcopy(void)
return migrate_postcopy_ram() || migrate_dirty_bitmaps();
}

bool migrate_rdma(void)
{
MigrationState *s = migrate_get_current();

return s->rdma_migration;
}

bool migrate_tls(void)
{
MigrationState *s = migrate_get_current();
Expand Down
1 change: 1 addition & 0 deletions migration/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ bool migrate_zero_copy_send(void);

bool migrate_multifd_flush_after_each_section(void);
bool migrate_postcopy(void);
bool migrate_rdma(void);
bool migrate_tls(void);

/* capabilities helpers */
Expand Down
4 changes: 3 additions & 1 deletion migration/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -4113,6 +4113,7 @@ static void rdma_accept_incoming_migration(void *opaque)

void rdma_start_incoming_migration(const char *host_port, Error **errp)
{
MigrationState *s = migrate_get_current();
int ret;
RDMAContext *rdma;

Expand Down Expand Up @@ -4144,7 +4145,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
}

trace_rdma_start_incoming_migration_after_rdma_listen();

s->rdma_migration = true;
qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration,
NULL, (void *)(intptr_t)rdma);
return;
Expand Down Expand Up @@ -4220,6 +4221,7 @@ void rdma_start_outgoing_migration(void *opaque,
trace_rdma_start_outgoing_migration_after_rdma_connect();

s->to_dst_file = rdma_new_output(rdma);
s->rdma_migration = true;
migrate_fd_connect(s, NULL);
return;
return_path_err:
Expand Down

0 comments on commit 27fd25b

Please sign in to comment.