[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 7/9] migration: modify migration_channels_and_uri_compatible()
|
From: |
Het Gala |
|
Subject: |
[PATCH v5 7/9] migration: modify migration_channels_and_uri_compatible() to incorporate newer migration QAPI syntax |
|
Date: |
Fri, 19 May 2023 09:46:15 +0000 |
migration_channels_and_uri_compatible() check for transport mechanism
suitable for multifd migration gets executed when the caller calls old
uri syntax. It needs it to be run when using the mordern MigrateCHannel
QAPI syntax too.
After URI -> 'MigrateChannel' object conversion,
migration_channels_and_uri_compatible() ->
migration_channels_and_transport_compatible() passes object as argument
and checks for valid transport mechanism.
Suggested-by: Aravind Retnakaran <aravind.retnakaran@nutanix.com>
Signed-off-by: Het Gala <het.gala@nutanix.com>
---
migration/migration.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index abccc6bf26..8afdea4f91 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -103,17 +103,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(MigrateAddress *addrs,
+ Error **errp)
{
if (migration_needs_multiple_sockets() &&
- !uri_supports_multi_channels(uri)) {
+ (addrs->transport == MIGRATE_TRANSPORT_SOCKET) &&
+ !transport_supports_multi_channels(&addrs->u.socket)) {
error_setg(errp, "Migration requires multi-channel URIs (e.g. tcp)");
return false;
}
@@ -479,12 +482,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;
}
@@ -1707,12 +1710,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;
}
--
2.22.3
- [PATCH v5 4/9] migration: convert rdma backend to accept MigrateAddress struct, (continued)
- [PATCH v5 4/9] migration: convert rdma backend to accept MigrateAddress struct, Het Gala, 2023/05/19
- [PATCH v5 3/9] migration: convert socket backend to accept MigrateAddress struct, Het Gala, 2023/05/19
- [PATCH v5 5/9] migration: convert exec backend to accept MigrateAddress struct., Het Gala, 2023/05/19
- [PATCH v5 2/9] migration: convert uri parameter into 'MigrateAddress' struct, Het Gala, 2023/05/19
- [PATCH v5 6/9] migration: modified migration QAPIs to accept 'channels' argument for migration, Het Gala, 2023/05/19
- [PATCH v5 9/9] migration: adding test case for modified QAPI syntax, Het Gala, 2023/05/19
- [PATCH v5 7/9] migration: modify migration_channels_and_uri_compatible() to incorporate newer migration QAPI syntax,
Het Gala <=
- [PATCH v5 8/9] migration: Introduced MigrateChannelList struct to migration code flow., Het Gala, 2023/05/19