@@ -107,17 +107,20 @@ static bool migration_needs_multiple_sockets(void)
return migrate_multifd() || migrate_postcopy_preempt();
}
-static bool uri_supports_multi_channels(const char *uri)
+static bool transport_supports_multi_channels(SocketAddress *saddr)
{
- return strstart(uri, "tcp:", NULL) || strstart(uri, "unix:", NULL) ||
- strstart(uri, "vsock:", NULL);
+ return saddr->type == SOCKET_ADDRESS_TYPE_INET ||
+ saddr->type == SOCKET_ADDRESS_TYPE_UNIX ||
+ saddr->type == SOCKET_ADDRESS_TYPE_VSOCK;
}
static bool
-migration_channels_and_uri_compatible(const char *uri, Error **errp)
+migration_channels_and_transport_compatible(MigrationAddress *addr,
+ Error **errp)
{
if (migration_needs_multiple_sockets() &&
- !uri_supports_multi_channels(uri)) {
+ (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) &&
+ !transport_supports_multi_channels(&addr->u.socket)) {
error_setg(errp, "Migration requires multi-channel URIs (e.g. tcp)");
return false;
}
@@ -503,12 +506,12 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels,
return;
}
- /* URI is not suitable for migration? */
- if (!migration_channels_and_uri_compatible(uri, errp)) {
+ if (uri && !migrate_uri_parse(uri, &channel, errp)) {
return;
}
- if (uri && !migrate_uri_parse(uri, &channel, errp)) {
+ /* transport mechanism not suitable for migration? */
+ if (!migration_channels_and_transport_compatible(channel, errp)) {
return;
}
@@ -1788,12 +1791,12 @@ void qmp_migrate(const char *uri, bool has_channels,
return;
}
- /* URI is not suitable for migration? */
- if (!migration_channels_and_uri_compatible(uri, errp)) {
+ if (!migrate_uri_parse(uri, &channel, errp)) {
return;
}
- if (!migrate_uri_parse(uri, &channel, errp)) {
+ /* transport mechanism not suitable for migration? */
+ if (!migration_channels_and_transport_compatible(channel, errp)) {
return;
}