On Mon, Nov 27, 2023 at 05:25:49PM -0300, Fabiano Rosas wrote: > The fixed-ram migration format needs a channel that supports seeking > to be able to write each page to an arbitrary offset in the migration > stream. > > Signed-off-by: Fabiano Rosas <faro...@suse.de> > Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> > --- > - avoided overwriting errp in compatibility check > --- > migration/migration.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/migration/migration.c b/migration/migration.c > index 28a34c9068..897ed1db67 100644 > --- a/migration/migration.c > +++ b/migration/migration.c > @@ -135,10 +135,26 @@ static bool > transport_supports_multi_channels(SocketAddress *saddr) > saddr->type == SOCKET_ADDRESS_TYPE_VSOCK; > } > > +static bool migration_needs_seekable_channel(void) > +{ > + return migrate_fixed_ram(); > +} > + > +static bool transport_supports_seeking(MigrationAddress *addr) > +{ > + return addr->transport == MIGRATION_ADDRESS_TYPE_FILE; > +}
What about TYPE_FD? Is it going to be supported later? > + > 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() && > (addr->transport == MIGRATION_ADDRESS_TYPE_SOCKET) && > !transport_supports_multi_channels(&addr->u.socket)) { > -- > 2.35.3 > -- Peter Xu