migration: incoming channel

Extend the -incoming option to allow an @MigrationChannel to be specified.
This allows channels other than 'main' to be described on the command
line, which will be needed for CPR.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Acked-by: Peter Xu <peterx@redhat.com>
Link: https://lore.kernel.org/r/1736967650-129648-13-git-send-email-steven.sistare@oracle.com
Signed-off-by: Fabiano Rosas <farosas@suse.de>
This commit is contained in:
Steve Sistare 2025-01-15 11:00:38 -08:00 committed by Fabiano Rosas
parent f2374f0fc3
commit 2862b6b924
3 changed files with 70 additions and 8 deletions

View file

@ -695,7 +695,8 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels,
if (channels) {
/* To verify that Migrate channel list has only item */
if (channels->next) {
error_setg(errp, "Channel list has more than one entries");
error_setg(errp, "Channel list must have only one entry, "
"for type 'main'");
return;
}
addr = channels->value->addr;
@ -2054,6 +2055,7 @@ void qmp_migrate(const char *uri, bool has_channels,
MigrationState *s = migrate_get_current();
g_autoptr(MigrationChannel) channel = NULL;
MigrationAddress *addr = NULL;
MigrationChannel *channelv[MIGRATION_CHANNEL_TYPE__MAX] = { NULL };
/*
* Having preliminary checks for uri and channel
@ -2064,12 +2066,21 @@ void qmp_migrate(const char *uri, bool has_channels,
}
if (channels) {
/* To verify that Migrate channel list has only item */
if (channels->next) {
error_setg(errp, "Channel list has more than one entries");
for ( ; channels; channels = channels->next) {
MigrationChannelType type = channels->value->channel_type;
if (channelv[type]) {
error_setg(errp, "Channel list has more than one %s entry",
MigrationChannelType_str(type));
return;
}
channelv[type] = channels->value;
}
addr = channelv[MIGRATION_CHANNEL_TYPE_MAIN]->addr;
if (!addr) {
error_setg(errp, "Channel list has no main entry");
return;
}
addr = channels->value->addr;
}
if (uri) {