qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] QAPI magician wanted ...


From: Eric Blake
Subject: Re: [Qemu-devel] QAPI magician wanted ...
Date: Thu, 12 Oct 2017 08:17:16 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 10/12/2017 07:38 AM, Igor Mammedov wrote:
> On Thu, 12 Oct 2017 13:28:26 +0100
> "Daniel P. Berrange" <address@hidden> wrote:
> 
>> On Thu, Oct 12, 2017 at 02:21:53PM +0200, Igor Mammedov wrote:
>>>
>>> I'm working on introducing QMP command to set numa mappings
>>> via QMP interface at runtime instead of CLI.
>>>
>>> I'd prefer to reuse NumaOptions for parsing input,
>>> but I can't wrap my head around QAPI magic.
>>>
>>> So far I've added new command in qapi-schema.json:
>>>
>>>   {
>>>     'command': 'set-numa-node',                                             
>>>        
>>>     'data': {'cmd': 'NumaOptions'}                                          
>>>        
>>>   }  
>>
>> I don't see any point in the extra level of nesting you have here, vs
>> using NumaOptions as the data directly eg
>>
>>    {
>>      'command': 'set-numa-node',
>>      'data': 'NumaOptions'              
>>    }
> I've tried that, it doesn't compile
>    'data' for command 'set-numa-node' cannot use union type 'NumaOptions'

{ 'command': 'set-numa-node', 'boxed': true,
  'data': 'NumaOptions' }

To use a union directly as the command (which is a GOOD idea), you have
to tell the generator to pass it as a boxed item to the
qmp_set_numa_node function, rather than as exploded parameters, since
the generator can't explode parameters from a union..

>> I think the union gets flattenned - ie you probably want
>>
>>    { "execute": "set-numa-node", "arguments": { "cmd": { "type": "node", 
>> "nodeid": 1 } } }
> thanks, that works for me 
> 
>>
>> Though with my suggestion above you could get it to just
>>
>>    { "execute": "set-numa-node", "arguments": { "type": "node", "nodeid": 1 
>> } }

Yes, I'd prefer this form without the extra nesting.


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]