All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] QAPI magician wanted ...
Date: Thu, 12 Oct 2017 13:28:26 +0100	[thread overview]
Message-ID: <20171012122826.GK16125@redhat.com> (raw)
In-Reply-To: <20171012142153.125b5bd8@nial.brq.redhat.com>

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	other threads:[~2017-10-12 12:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-12 12:21 [Qemu-devel] QAPI magician wanted Igor Mammedov
2017-10-12 12:28 ` Daniel P. Berrange [this message]
2017-10-12 12:38   ` Igor Mammedov
2017-10-12 13:17     ` Eric Blake
2017-10-12 16:29       ` Igor Mammedov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171012122826.GK16125@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.