[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v13 07/10] migration: modify migration_channels_and_uri_compatibl
|
From: |
Het Gala |
|
Subject: |
[PATCH v13 07/10] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax |
|
Date: |
Thu, 12 Oct 2023 15:10:49 +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 modern MigrateChannel
QAPI syntax too.
After URI -> 'MigrateChannel' :
migration_channels_and_uri_compatible() ->
migration_channels_and_transport_compatible() passes object as argument
and check for valid transport mechanism.
Suggested-by: Aravind Retnakaran <aravind.retnakaran@nutanix.com>
Signed-off-by: Het Gala <het.gala@nutanix.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
migration/migration.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index da50b83e5c..cf5a620c8e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -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;
}
--
2.22.3
- [PATCH v13 00/10] migration: Modify 'migrate' and 'migrate-incoming' QAPI commands for migration, Het Gala, 2023/10/12
- [PATCH v13 01/10] migration: New QAPI type 'MigrateAddress', Het Gala, 2023/10/12
- [PATCH v13 03/10] migration: convert socket backend to accept MigrateAddress, Het Gala, 2023/10/12
- [PATCH v13 02/10] migration: convert migration 'uri' into 'MigrateAddress', Het Gala, 2023/10/12
- [PATCH v13 04/10] migration: convert rdma backend to accept MigrateAddress, Het Gala, 2023/10/12
- [PATCH v13 05/10] migration: convert exec backend to accept MigrateAddress., Het Gala, 2023/10/12
- [PATCH v13 07/10] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax,
Het Gala <=
- [PATCH v13 06/10] migration: New migrate and migrate-incoming argument 'channels', Het Gala, 2023/10/12
- [PATCH v13 08/10] migration: Implement MigrateChannelList to qmp migration flow., Het Gala, 2023/10/12
- [PATCH v13 10/10] migration: modify test_multifd_tcp_none() to use new QAPI syntax., Het Gala, 2023/10/12
- [PATCH v13 09/10] migration: Implement MigrateChannelList to hmp migration flow., Het Gala, 2023/10/12
- Re: [PATCH v13 00/10] migration: Modify 'migrate' and 'migrate-incoming' QAPI commands for migration, Het Gala, 2023/10/18