Skip to content

Commit

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

Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20230509120700.78359-2-quintela@redhat.com>
  • Loading branch information
Juan Quintela committed May 30, 2023
1 parent 34ea361 commit 9399cf2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions migration/migration.c
Expand Up @@ -1405,6 +1405,7 @@ void migrate_init(MigrationState *s)
s->vm_old_state = -1;
s->iteration_initial_bytes = 0;
s->threshold_size = 0;
s->rdma_migration = false;
}

int migrate_add_blocker_internal(Error *reason, Error **errp)
Expand Down
3 changes: 3 additions & 0 deletions migration/migration.h
Expand Up @@ -440,6 +440,9 @@ struct MigrationState {

/* QEMU_VM_VMDESCRIPTION content filled for all non-iterable devices. */
JSONWriter *vmdesc;

/* 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
Expand Up @@ -350,6 +350,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
Expand Up @@ -54,6 +54,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
Expand Up @@ -4122,6 +4122,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
int ret;
RDMAContext *rdma;
Error *local_err = NULL;
MigrationState *s = migrate_get_current();

trace_rdma_start_incoming_migration();

Expand Down Expand Up @@ -4152,7 +4153,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 @@ -4228,6 +4229,7 @@ void rdma_start_outgoing_migration(void *opaque,

trace_rdma_start_outgoing_migration_after_rdma_connect();

s->rdma_migration = true;
s->to_dst_file = qemu_fopen_rdma(rdma, "wb");
migrate_fd_connect(s, NULL);
return;
Expand Down

0 comments on commit 9399cf2

Please sign in to comment.