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: Daniel P. Berrange
Subject: Re: [Qemu-devel] QAPI magician wanted ...
Date: Thu, 12 Oct 2017 13:28:26 +0100
User-agent: Mutt/1.9.0 (2017-09-02)

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'              
   }


> it at least compiles and manages to handle input without union part
> 
>   { "execute": "set-numa-node", "arguments": { "cmd": { "type": "node" } } }
> 
> however I can't figure out syntax that adds union part to it,
> I have tried something like this
> 
>   { "execute": "set-numa-node", "arguments": { "cmd": { "type": "node", 
> "node" : { "nodeid": 1 } } } }
> 
> but it errors out with
> 
>   {"error": {"class": "GenericError", "desc": "Parameter 'cmd.node' is 
> unexpected"}}
> 
> Any advice on how to make it work if possible at all or
> alternative ways how to achieve the end goal.

I think the union gets flattenned - ie you probably want

   { "execute": "set-numa-node", "arguments": { "cmd": { "type": "node", 
"nodeid": 1 } } }

Though with my suggestion above you could get it to just

   { "execute": "set-numa-node", "arguments": { "type": "node", "nodeid": 1 } }

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



reply via email to

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