mirror of
https://github.com/qemu/qemu.git
synced 2024-11-23 19:03:38 +08:00
migration/multifd: Move multifd_send_setup error handling in to the function
Hide the error handling inside multifd_send_setup to make it cleaner for the next patch to move the function around. Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de> Link: https://lore.kernel.org/r/20240206215118.6171-4-farosas@suse.de Signed-off-by: Peter Xu <peterx@redhat.com>
This commit is contained in:
parent
a2a63c4abd
commit
bd8b0a8f82
@ -3635,11 +3635,7 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)
|
||||
return;
|
||||
}
|
||||
|
||||
if (multifd_send_setup(&local_err) != 0) {
|
||||
migrate_set_error(s, local_err);
|
||||
error_report_err(local_err);
|
||||
migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,
|
||||
MIGRATION_STATUS_FAILED);
|
||||
if (!multifd_send_setup()) {
|
||||
migrate_fd_cleanup(s);
|
||||
return;
|
||||
}
|
||||
|
@ -985,14 +985,16 @@ static void multifd_new_send_channel_create(gpointer opaque)
|
||||
socket_send_channel_create(multifd_new_send_channel_async, opaque);
|
||||
}
|
||||
|
||||
int multifd_send_setup(Error **errp)
|
||||
bool multifd_send_setup(void)
|
||||
{
|
||||
int thread_count;
|
||||
MigrationState *s = migrate_get_current();
|
||||
Error *local_err = NULL;
|
||||
int thread_count, ret = 0;
|
||||
uint32_t page_count = MULTIFD_PACKET_SIZE / qemu_target_page_size();
|
||||
uint8_t i;
|
||||
|
||||
if (!migrate_multifd()) {
|
||||
return 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
thread_count = migrate_multifd_channels();
|
||||
@ -1026,14 +1028,22 @@ int multifd_send_setup(Error **errp)
|
||||
|
||||
for (i = 0; i < thread_count; i++) {
|
||||
MultiFDSendParams *p = &multifd_send_state->params[i];
|
||||
int ret;
|
||||
|
||||
ret = multifd_send_state->ops->send_setup(p, errp);
|
||||
ret = multifd_send_state->ops->send_setup(p, &local_err);
|
||||
if (ret) {
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
if (ret) {
|
||||
migrate_set_error(s, local_err);
|
||||
error_report_err(local_err);
|
||||
migrate_set_state(&s->state, MIGRATION_STATUS_SETUP,
|
||||
MIGRATION_STATUS_FAILED);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct {
|
||||
|
@ -13,7 +13,7 @@
|
||||
#ifndef QEMU_MIGRATION_MULTIFD_H
|
||||
#define QEMU_MIGRATION_MULTIFD_H
|
||||
|
||||
int multifd_send_setup(Error **errp);
|
||||
bool multifd_send_setup(void);
|
||||
void multifd_send_shutdown(void);
|
||||
int multifd_recv_setup(Error **errp);
|
||||
void multifd_recv_cleanup(void);
|
||||
|
Loading…
Reference in New Issue
Block a user