diff mbox

[v2,1/3] qapi: convert NumaOptions into a flat union

Message ID 7567ba6259b039b5d89faf658c8f52d500e2595c.1443017811.git.DirtY.iCE.hu@gmail.com
State New
Headers show

Commit Message

=?UTF-8?B?Wm9sdMOhbiBLxZF2w6Fnw7M=?= Sept. 23, 2015, 2:27 p.m. UTC
Changes the NumaOptions to flat union from a simple one.  This is
required by my later OptsVisitor patch to preserve backward
compatibility.

Strictly speaking this would break QMP compatibility (as specified in
docs/qapi-code-gen.txt), but since no QMP command use this structure,
it's not an issue.  The -numa option syntax doesn't change.  There are
some changes in the C api, but this patch fixes them.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>

---

Changes from v1:
* fixed documentation

 numa.c           |  2 +-
 qapi-schema.json | 49 ++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 39 insertions(+), 12 deletions(-)

Comments

Eric Blake Sept. 23, 2015, 2:40 p.m. UTC | #1
On 09/23/2015 08:27 AM, Kővágó, Zoltán wrote:
> Changes the NumaOptions to flat union from a simple one.  This is
> required by my later OptsVisitor patch to preserve backward
> compatibility.
> 
> Strictly speaking this would break QMP compatibility (as specified in
> docs/qapi-code-gen.txt), but since no QMP command use this structure,
> it's not an issue.  The -numa option syntax doesn't change.  There are
> some changes in the C api, but this patch fixes them.
> 
> Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
> ---
> 
> Changes from v1:
> * fixed documentation

Since you're basing this on top of my pending series, why not take
advantage of it...


> +##
> +# @NumaCommonOptions
> +#
> +# Common set of numa options.
> +#
> +# @type: NUMA command-line option type.
> +#
> +# Since: 2.5
> +##
> +{ 'struct': 'NumaCommonOptions',
> +  'data': {
> +    'type': 'NumaOptionType' } }

...by dropping this type, and instead...

> +
> +##
> +# @NumaOptions
> +#

...document @type here, and...

> +# A discriminated record of NUMA options. (for OptsVisitor)
> +#
> +# Since 2.1
> +##
> +{ 'union': 'NumaOptions',
> +  'base': 'NumaCommonOptions',

...write this as 'base': { 'type': 'NumaOptionType' },

> +  'discriminator': 'type',
> +  'data': {
> +    'node': 'NumaNodeOptions' }}
> +
> +##
>  # @HostMemPolicy
>  #
>  # Host memory policy types
>
=?UTF-8?B?Wm9sdMOhbiBLxZF2w6Fnw7M=?= Sept. 23, 2015, 5:05 p.m. UTC | #2
2015-09-23 16:40 keltezéssel, Eric Blake írta:
> On 09/23/2015 08:27 AM, Kővágó, Zoltán wrote:
>> Changes the NumaOptions to flat union from a simple one.  This is
>> required by my later OptsVisitor patch to preserve backward
>> compatibility.
>>
>> Strictly speaking this would break QMP compatibility (as specified in
>> docs/qapi-code-gen.txt), but since no QMP command use this structure,
>> it's not an issue.  The -numa option syntax doesn't change.  There are
>> some changes in the C api, but this patch fixes them.
>>
>> Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>>
>> ---
>>
>> Changes from v1:
>> * fixed documentation
>
> Since you're basing this on top of my pending series, why not take
> advantage of it...

Oh, so now that's possible.  I was too lazy to read the changes you have 
made to qapi...

Then I suppose I should do the same thing with NetLegacy.

>
>
>> +##
>> +# @NumaCommonOptions
>> +#
>> +# Common set of numa options.
>> +#
>> +# @type: NUMA command-line option type.
>> +#
>> +# Since: 2.5
>> +##
>> +{ 'struct': 'NumaCommonOptions',
>> +  'data': {
>> +    'type': 'NumaOptionType' } }
>
> ...by dropping this type, and instead...
>
>> +
>> +##
>> +# @NumaOptions
>> +#
>
> ...document @type here, and...
>
>> +# A discriminated record of NUMA options. (for OptsVisitor)
>> +#
>> +# Since 2.1
>> +##
>> +{ 'union': 'NumaOptions',
>> +  'base': 'NumaCommonOptions',
>
> ...write this as 'base': { 'type': 'NumaOptionType' },
>
>> +  'discriminator': 'type',
>> +  'data': {
>> +    'node': 'NumaNodeOptions' }}
>> +
>> +##
>>   # @HostMemPolicy
>>   #
>>   # Host memory policy types
>>
>
diff mbox

Patch

diff --git a/numa.c b/numa.c
index 16a8c41..9cd0c84 100644
--- a/numa.c
+++ b/numa.c
@@ -227,7 +227,7 @@  static int parse_numa(void *opaque, QemuOpts *opts, Error **errp)
     }
 
     switch (object->type) {
-    case NUMA_OPTIONS_KIND_NODE:
+    case NUMA_OPTION_TYPE_NODE:
         numa_node_parse(object->node, opts, &err);
         if (err) {
             goto error;
diff --git a/qapi-schema.json b/qapi-schema.json
index 263053d..72827f8 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3573,17 +3573,6 @@ 
   'data': { '*console':'int', 'events': [ 'InputEvent' ] } }
 
 ##
-# @NumaOptions
-#
-# A discriminated record of NUMA options. (for OptsVisitor)
-#
-# Since 2.1
-##
-{ 'union': 'NumaOptions',
-  'data': {
-    'node': 'NumaNodeOptions' }}
-
-##
 # @NumaNodeOptions
 #
 # Create a guest NUMA node. (for OptsVisitor)
@@ -3610,6 +3599,44 @@ 
    '*memdev': 'str' }}
 
 ##
+# @NumaOptionType
+#
+# NUMA command-line option type.
+#
+# @node: Create a guest NUMA node. See @NumaNodeOptions.
+#
+# Since: 2.5
+##
+{ 'enum': 'NumaOptionType',
+  'data': [ 'node' ] }
+
+##
+# @NumaCommonOptions
+#
+# Common set of numa options.
+#
+# @type: NUMA command-line option type.
+#
+# Since: 2.5
+##
+{ 'struct': 'NumaCommonOptions',
+  'data': {
+    'type': 'NumaOptionType' } }
+
+##
+# @NumaOptions
+#
+# A discriminated record of NUMA options. (for OptsVisitor)
+#
+# Since 2.1
+##
+{ 'union': 'NumaOptions',
+  'base': 'NumaCommonOptions',
+  'discriminator': 'type',
+  'data': {
+    'node': 'NumaNodeOptions' }}
+
+##
 # @HostMemPolicy
 #
 # Host memory policy types