migration: unify incoming processing

This is the 2nd patch to unbreak postcopy recovery.

Let's unify the migration_incoming_process() call at a single place
rather than calling it in connection setup codes.  This fixes a problem
that we will go into incoming migration procedure even if we are trying
to recovery from a paused postcopy migration.

Fixes: 36c2f8be2c ("migration: Delay start of migration main routines")
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <20180627132246.5576-5-peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
Peter Xu 2018-06-27 21:22:46 +08:00 committed by Dr. David Alan Gilbert
parent 884835fa1e
commit a429e7f488
4 changed files with 16 additions and 13 deletions

View File

@ -49,9 +49,6 @@ static gboolean exec_accept_incoming_migration(QIOChannel *ioc,
{
migration_channel_process_incoming(ioc);
object_unref(OBJECT(ioc));
if (!migrate_use_multifd()) {
migration_incoming_process();
}
return G_SOURCE_REMOVE;
}

View File

@ -49,9 +49,6 @@ static gboolean fd_accept_incoming_migration(QIOChannel *ioc,
{
migration_channel_process_incoming(ioc);
object_unref(OBJECT(ioc));
if (!migrate_use_multifd()) {
migration_incoming_process();
}
return G_SOURCE_REMOVE;
}

View File

@ -511,17 +511,31 @@ void migration_fd_process_incoming(QEMUFile *f)
void migration_ioc_process_incoming(QIOChannel *ioc)
{
MigrationIncomingState *mis = migration_incoming_get_current();
bool start_migration;
if (!mis->from_src_file) {
/* The first connection (multifd may have multiple) */
QEMUFile *f = qemu_fopen_channel_input(ioc);
/* If it's a recovery, we're done */
if (postcopy_try_recover(f)) {
return;
}
migration_incoming_setup(f);
return;
/*
* Common migration only needs one channel, so we can start
* right now. Multifd needs more than one channel, we wait.
*/
start_migration = !migrate_use_multifd();
} else {
/* Multiple connections */
assert(migrate_use_multifd());
start_migration = multifd_recv_new_channel(ioc);
}
if (multifd_recv_new_channel(ioc)) {
if (start_migration) {
migration_incoming_process();
}
}

View File

@ -168,12 +168,7 @@ static void socket_accept_incoming_migration(QIONetListener *listener,
if (migration_has_all_channels()) {
/* Close listening socket as its no longer needed */
qio_net_listener_disconnect(listener);
object_unref(OBJECT(listener));
if (!migrate_use_multifd()) {
migration_incoming_process();
}
}
}