[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 08/23] migration: Add mapped-ram URI compatibility check
From: |
Fabiano Rosas |
Subject: |
[PATCH v5 08/23] migration: Add mapped-ram URI compatibility check |
Date: |
Wed, 28 Feb 2024 12:21:12 -0300 |
The mapped-ram migration format needs a channel that supports seeking
to be able to write each page to an arbitrary offset in the migration
stream.
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
migration/migration.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/migration/migration.c b/migration/migration.c
index 25f01d7818..c1cc003b99 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -147,10 +147,39 @@ static bool
transport_supports_multi_channels(MigrationAddress *addr)
return false;
}
+static bool migration_needs_seekable_channel(void)
+{
+ return migrate_mapped_ram();
+}
+
+static bool transport_supports_seeking(MigrationAddress *addr)
+{
+ if (addr->transport == MIGRATION_ADDRESS_TYPE_FILE) {
+ return true;
+ }
+
+ /*
+ * At this point, the user might not yet have passed the file
+ * descriptor to QEMU, so we cannot know for sure whether it
+ * refers to a plain file or a socket. Let it through anyway.
+ */
+ if (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) {
+ return addr->u.socket.type == SOCKET_ADDRESS_TYPE_FD;
+ }
+
+ return false;
+}
+
static bool
migration_channels_and_transport_compatible(MigrationAddress *addr,
Error **errp)
{
+ if (migration_needs_seekable_channel() &&
+ !transport_supports_seeking(addr)) {
+ error_setg(errp, "Migration requires seekable transport (e.g. file)");
+ return false;
+ }
+
if (migration_needs_multiple_sockets() &&
!transport_supports_multi_channels(addr)) {
error_setg(errp, "Migration requires multi-channel URIs (e.g. tcp)");
--
2.35.3
- [PATCH v5 01/23] migration/multifd: Cleanup multifd_recv_sync_main, (continued)
- [PATCH v5 01/23] migration/multifd: Cleanup multifd_recv_sync_main, Fabiano Rosas, 2024/02/28
- [PATCH v5 02/23] io: add and implement QIO_CHANNEL_FEATURE_SEEKABLE for channel file, Fabiano Rosas, 2024/02/28
- [PATCH v5 03/23] io: Add generic pwritev/preadv interface, Fabiano Rosas, 2024/02/28
- [PATCH v5 04/23] io: implement io_pwritev/preadv for QIOChannelFile, Fabiano Rosas, 2024/02/28
- [PATCH v5 05/23] io: fsync before closing a file channel, Fabiano Rosas, 2024/02/28
- [PATCH v5 07/23] migration/ram: Introduce 'mapped-ram' migration capability, Fabiano Rosas, 2024/02/28
- [PATCH v5 06/23] migration/qemu-file: add utility methods for working with seekable channels, Fabiano Rosas, 2024/02/28
- [PATCH v5 09/23] migration/ram: Add outgoing 'mapped-ram' migration, Fabiano Rosas, 2024/02/28
- [PATCH v5 08/23] migration: Add mapped-ram URI compatibility check,
Fabiano Rosas <=
- [PATCH v5 11/23] tests/qtest/migration: Add tests for mapped-ram file-based migration, Fabiano Rosas, 2024/02/28
- [PATCH v5 12/23] migration/multifd: Rename MultiFDSend|RecvParams::data to compress_data, Fabiano Rosas, 2024/02/28
- [PATCH v5 13/23] migration/multifd: Decouple recv method from pages, Fabiano Rosas, 2024/02/28
- [PATCH v5 15/23] migration/multifd: Allow receiving pages without packets, Fabiano Rosas, 2024/02/28
- [PATCH v5 14/23] migration/multifd: Allow multifd without packets, Fabiano Rosas, 2024/02/28
- [PATCH v5 10/23] migration/ram: Add incoming 'mapped-ram' migration, Fabiano Rosas, 2024/02/28
- [PATCH v5 16/23] migration/multifd: Add a wrapper for channels_created, Fabiano Rosas, 2024/02/28