[RFC PATCH v3 07/30] migration: Add fixed-ram URI compatibility check

Fabiano Rosas posted 30 patches 1 year ago
Maintainers: Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Leonardo Bras <leobras@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, David Hildenbrand <david@redhat.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, "Daniel P. Berrangé" <berrange@redhat.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>
There is a newer version of this series
[RFC PATCH v3 07/30] migration: Add fixed-ram URI compatibility check
Posted by Fabiano Rosas 1 year ago
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 <farosas@suse.de>
Reviewed-by: Daniel P. Berrangé <berrange@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;
+}
+
 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


Re: [RFC PATCH v3 07/30] migration: Add fixed-ram URI compatibility check
Posted by Peter Xu 10 months, 2 weeks ago
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 <farosas@suse.de>
> Reviewed-by: Daniel P. Berrangé <berrange@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


Re: [RFC PATCH v3 07/30] migration: Add fixed-ram URI compatibility check
Posted by Fabiano Rosas 10 months, 1 week ago
Peter Xu <peterx@redhat.com> writes:

> 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 <farosas@suse.de>
>> Reviewed-by: Daniel P. Berrangé <berrange@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?
>

Sorry, I missed this one.

Yes, and thanks for asking because I just remembered I have code for
this lost in a git stash somewhere. I'll include it in v4.

>> +
>>  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
>> 
Re: [RFC PATCH v3 07/30] migration: Add fixed-ram URI compatibility check
Posted by Fabiano Rosas 10 months, 1 week ago
Peter Xu <peterx@redhat.com> writes:

> 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 <farosas@suse.de>
>> Reviewed-by: Daniel P. Berrangé <berrange@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?
>

nSorry, I missed this one.

Yes, and thanks for asking because I just remembered I have code for
this lost in a git stash somewhere. I'll include it in v4.

>> +
>>  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
>>