Skip to content

Commit

Permalink
migration: Allow migrate_fd_connect to take an Error *
Browse files Browse the repository at this point in the history
Allow whatever is performing the connection to pass migrate_fd_connect
an error to indicate there was a problem during connection, an allow
us to clean up.

The caller must free the error.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
  • Loading branch information
dagrh committed Feb 6, 2018
1 parent 2b3805f commit cce8040
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion migration/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ void migration_channel_connect(MigrationState *s,

s->to_dst_file = f;

migrate_fd_connect(s);
migrate_fd_connect(s, NULL);
}
}
7 changes: 6 additions & 1 deletion migration/migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -2378,10 +2378,15 @@ static void *migration_thread(void *opaque)
return NULL;
}

void migrate_fd_connect(MigrationState *s)
void migrate_fd_connect(MigrationState *s, Error *error_in)
{
s->expected_downtime = s->parameters.downtime_limit;
s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup, s);
if (error_in) {
migrate_fd_error(s, error_in);
migrate_fd_cleanup(s);
return;
}

qemu_file_set_blocking(s->to_dst_file, true);
qemu_file_set_rate_limit(s->to_dst_file,
Expand Down
2 changes: 1 addition & 1 deletion migration/migration.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ uint64_t migrate_max_downtime(void);
void migrate_set_error(MigrationState *s, const Error *error);
void migrate_fd_error(MigrationState *s, const Error *error);

void migrate_fd_connect(MigrationState *s);
void migrate_fd_connect(MigrationState *s, Error *error_in);

MigrationState *migrate_init(void);
bool migration_is_blocked(Error **errp);
Expand Down
2 changes: 1 addition & 1 deletion migration/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -3758,7 +3758,7 @@ void rdma_start_outgoing_migration(void *opaque,
trace_rdma_start_outgoing_migration_after_rdma_connect();

s->to_dst_file = qemu_fopen_rdma(rdma, "wb");
migrate_fd_connect(s);
migrate_fd_connect(s, NULL);
return;
err:
g_free(rdma);
Expand Down

0 comments on commit cce8040

Please sign in to comment.