[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 37/40] migration: modify migration_channels_and_uri_compatible() f
From: |
Juan Quintela |
Subject: |
[PULL 37/40] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax |
Date: |
Thu, 2 Nov 2023 12:40:51 +0100 |
From: Het Gala <het.gala@nutanix.com>
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>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231023182053.8711-12-farosas@suse.de>
---
migration/migration.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index a9cd5e2d5d..70725a89ab 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -128,17 +128,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;
}
@@ -534,15 +537,15 @@ 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)) {
- return;
- }
-
if (uri && !migrate_uri_parse(uri, &channel, errp)) {
return;
}
+ /* transport mechanism not suitable for migration? */
+ if (!migration_channels_and_transport_compatible(channel, errp)) {
+ return;
+ }
+
migrate_set_state(&mis->state, MIGRATION_STATUS_NONE,
MIGRATION_STATUS_SETUP);
@@ -1947,15 +1950,15 @@ void qmp_migrate(const char *uri, bool has_channels,
return;
}
- /* URI is not suitable for migration? */
- if (!migration_channels_and_uri_compatible(uri, errp)) {
- return;
- }
-
if (!migrate_uri_parse(uri, &channel, errp)) {
return;
}
+ /* transport mechanism not suitable for migration? */
+ if (!migration_channels_and_transport_compatible(channel, errp)) {
+ return;
+ }
+
resume_requested = has_resume && resume;
if (!migrate_prepare(s, has_blk && blk, has_inc && inc,
resume_requested, errp)) {
--
2.41.0
- [PULL 26/40] migration: Refactor error handling in source return path, (continued)
- [PULL 26/40] migration: Refactor error handling in source return path, Juan Quintela, 2023/11/02
- [PULL 27/40] migration: Allow network to fail even during recovery, Juan Quintela, 2023/11/02
- [PULL 28/40] tests/migration-test: Add a test for postcopy hangs during RECOVER, Juan Quintela, 2023/11/02
- [PULL 29/40] migration: Change ram_dirty_bitmap_reload() retval to bool, Juan Quintela, 2023/11/02
- [PULL 31/40] migration: convert migration 'uri' into 'MigrateAddress', Juan Quintela, 2023/11/02
- [PULL 30/40] migration: New QAPI type 'MigrateAddress', Juan Quintela, 2023/11/02
- [PULL 32/40] migration: convert socket backend to accept MigrateAddress, Juan Quintela, 2023/11/02
- [PULL 33/40] migration: convert rdma backend to accept MigrateAddress, Juan Quintela, 2023/11/02
- [PULL 35/40] migration: Convert the file backend to the new QAPI syntax, Juan Quintela, 2023/11/02
- [PULL 34/40] migration: convert exec backend to accept MigrateAddress., Juan Quintela, 2023/11/02
- [PULL 37/40] migration: modify migration_channels_and_uri_compatible() for new QAPI syntax,
Juan Quintela <=
- [PULL 36/40] migration: New migrate and migrate-incoming argument 'channels', Juan Quintela, 2023/11/02
- [PULL 39/40] migration: Implement MigrateChannelList to hmp migration flow., Juan Quintela, 2023/11/02
- [PULL 38/40] migration: Implement MigrateChannelList to qmp migration flow., Juan Quintela, 2023/11/02
- [PULL 40/40] migration: modify test_multifd_tcp_none() to use new QAPI syntax., Juan Quintela, 2023/11/02
- Re: [PULL 00/40] Migration 20231102 patches, Stefan Hajnoczi, 2023/11/02