[PATCH 16/21] qapi/migration: Mark that query/set-migrate-parameters support capabilities

Fabiano Rosas posted 21 patches 5 months, 2 weeks ago
Maintainers: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Laurent Vivier <lvivier@redhat.com>
There is a newer version of this series
[PATCH 16/21] qapi/migration: Mark that query/set-migrate-parameters support capabilities
Posted by Fabiano Rosas 5 months, 2 weeks ago
Add a QAPI command feature "capabilities" that can be queried by the
client to check that the parameters commands now also support
capabilities.

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 qapi/migration.json | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/qapi/migration.json b/qapi/migration.json
index 5942622ba7..557a9c523e 100644
--- a/qapi/migration.json
+++ b/qapi/migration.json
@@ -776,6 +776,13 @@
 #
 # Set various migration parameters.
 #
+# Features:
+#
+# @capabilities: Indicates this command supports setting the set of
+# parameters previously known as capabilities.  This means this
+# command can (and should) be used instead of the depreacated
+# @migrate-set-capabilities.
+#
 # Since: 2.4
 #
 # .. qmp-example::
@@ -785,7 +792,8 @@
 #     <- { "return": {} }
 ##
 { 'command': 'migrate-set-parameters', 'boxed': true,
-  'data': 'MigrationParameters' }
+  'data': 'MigrationParameters',
+  'features': [ 'capabilities' ] }
 
 ##
 # @MigrationParameters:
@@ -1110,6 +1118,13 @@
 #
 # Returns: @MigrationParameters
 #
+# Features:
+#
+# @capabilities: Indicates this command supports setting the set of
+# parameters previously known as capabilities.  This means this
+# command can (and should) be used instead of the depreacated
+# @migrate-set-capabilities.
+#
 # Since: 2.4
 #
 # .. qmp-example::
@@ -1125,7 +1140,8 @@
 #        }
 ##
 { 'command': 'query-migrate-parameters',
-  'returns': 'MigrationParameters' }
+  'returns': 'MigrationParameters',
+  'features': [ 'capabilities' ] }
 
 ##
 # @migrate-start-postcopy:
-- 
2.35.3
Re: [PATCH 16/21] qapi/migration: Mark that query/set-migrate-parameters support capabilities
Posted by Daniel P. Berrangé 5 months, 2 weeks ago
On Mon, Jun 02, 2025 at 10:38:05PM -0300, Fabiano Rosas wrote:
> Add a QAPI command feature "capabilities" that can be queried by the
> client to check that the parameters commands now also support
> capabilities.
> 
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---
>  qapi/migration.json | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/qapi/migration.json b/qapi/migration.json
> index 5942622ba7..557a9c523e 100644
> --- a/qapi/migration.json
> +++ b/qapi/migration.json
> @@ -776,6 +776,13 @@
>  #
>  # Set various migration parameters.
>  #
> +# Features:
> +#
> +# @capabilities: Indicates this command supports setting the set of
> +# parameters previously known as capabilities.  This means this
> +# command can (and should) be used instead of the depreacated
> +# @migrate-set-capabilities.
> +#
>  # Since: 2.4
>  #
>  # .. qmp-example::
> @@ -785,7 +792,8 @@
>  #     <- { "return": {} }
>  ##
>  { 'command': 'migrate-set-parameters', 'boxed': true,
> -  'data': 'MigrationParameters' }
> +  'data': 'MigrationParameters',
> +  'features': [ 'capabilities' ] }
>  
>  ##
>  # @MigrationParameters:
> @@ -1110,6 +1118,13 @@
>  #
>  # Returns: @MigrationParameters
>  #
> +# Features:
> +#
> +# @capabilities: Indicates this command supports setting the set of
> +# parameters previously known as capabilities.  This means this
> +# command can (and should) be used instead of the depreacated
> +# @migrate-set-capabilities.
> +#
>  # Since: 2.4
>  #
>  # .. qmp-example::
> @@ -1125,7 +1140,8 @@
>  #        }
>  ##
>  { 'command': 'query-migrate-parameters',
> -  'returns': 'MigrationParameters' }
> +  'returns': 'MigrationParameters',
> +  'features': [ 'capabilities' ] }
>

Adding QAPI "features" is only needed if there is no other viable
way to detect existence of the feature. In this case, apps can
trivially detect the feature by querying the QAPI schema and
identifying that the MigrationParameters struct has gained a
load of new fields. So IMHO this patch can be dropped.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Re: [PATCH 16/21] qapi/migration: Mark that query/set-migrate-parameters support capabilities
Posted by Fabiano Rosas 5 months, 1 week ago
Daniel P. Berrangé <berrange@redhat.com> writes:

> On Mon, Jun 02, 2025 at 10:38:05PM -0300, Fabiano Rosas wrote:
>> Add a QAPI command feature "capabilities" that can be queried by the
>> client to check that the parameters commands now also support
>> capabilities.
>> 
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> ---
>>  qapi/migration.json | 20 ++++++++++++++++++--
>>  1 file changed, 18 insertions(+), 2 deletions(-)
>> 
>> diff --git a/qapi/migration.json b/qapi/migration.json
>> index 5942622ba7..557a9c523e 100644
>> --- a/qapi/migration.json
>> +++ b/qapi/migration.json
>> @@ -776,6 +776,13 @@
>>  #
>>  # Set various migration parameters.
>>  #
>> +# Features:
>> +#
>> +# @capabilities: Indicates this command supports setting the set of
>> +# parameters previously known as capabilities.  This means this
>> +# command can (and should) be used instead of the depreacated
>> +# @migrate-set-capabilities.
>> +#
>>  # Since: 2.4
>>  #
>>  # .. qmp-example::
>> @@ -785,7 +792,8 @@
>>  #     <- { "return": {} }
>>  ##
>>  { 'command': 'migrate-set-parameters', 'boxed': true,
>> -  'data': 'MigrationParameters' }
>> +  'data': 'MigrationParameters',
>> +  'features': [ 'capabilities' ] }
>>  
>>  ##
>>  # @MigrationParameters:
>> @@ -1110,6 +1118,13 @@
>>  #
>>  # Returns: @MigrationParameters
>>  #
>> +# Features:
>> +#
>> +# @capabilities: Indicates this command supports setting the set of
>> +# parameters previously known as capabilities.  This means this
>> +# command can (and should) be used instead of the depreacated
>> +# @migrate-set-capabilities.
>> +#
>>  # Since: 2.4
>>  #
>>  # .. qmp-example::
>> @@ -1125,7 +1140,8 @@
>>  #        }
>>  ##
>>  { 'command': 'query-migrate-parameters',
>> -  'returns': 'MigrationParameters' }
>> +  'returns': 'MigrationParameters',
>> +  'features': [ 'capabilities' ] }
>>
>
> Adding QAPI "features" is only needed if there is no other viable
> way to detect existence of the feature. In this case, apps can
> trivially detect the feature by querying the QAPI schema and
> identifying that the MigrationParameters struct has gained a
> load of new fields. So IMHO this patch can be dropped.
>

Oh, ok. I was thinking this would be friendlier to the management layer,
but if it's all the same I'll drop it. Same for the other one in patch
19.

Thanks