* [Qemu-devel] QMP's success response
@ 2009-12-17 17:41 Luiz Capitulino
2009-12-17 17:46 ` [Qemu-devel] " Daniel P. Berrange
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Luiz Capitulino @ 2009-12-17 17:41 UTC (permalink / raw)
To: qemu-devel; +Cc: aliguori, armbru, avi
Hi there,
Currently, when a regular command doesn't have any data to output,
QMP will emit:
{ "return": "OK" }
I thought this was a good idea because it has a clear meaning. Silly me,
this is optimized for humans, but for machines it introduces the problem
that such commands can't be changed to return values.
I'm not sure this is will ever happen, but to stay safe a better way
would be to return an empty dict, like this:
{ "return": {} }
Which can be read as 'command succeeded, but didn't return any data'.
As the release is not done yet we still can change it, is anyone against?
^ permalink raw reply [flat|nested] 5+ messages in thread* [Qemu-devel] Re: QMP's success response
2009-12-17 17:41 [Qemu-devel] QMP's success response Luiz Capitulino
@ 2009-12-17 17:46 ` Daniel P. Berrange
2009-12-17 18:32 ` [Qemu-devel] " Markus Armbruster
2009-12-17 19:09 ` Jamie Lokier
2 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrange @ 2009-12-17 17:46 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: aliguori, avi, qemu-devel, armbru
On Thu, Dec 17, 2009 at 03:41:47PM -0200, Luiz Capitulino wrote:
>
> Hi there,
>
> Currently, when a regular command doesn't have any data to output,
> QMP will emit:
>
> { "return": "OK" }
>
> I thought this was a good idea because it has a clear meaning. Silly me,
> this is optimized for humans, but for machines it introduces the problem
> that such commands can't be changed to return values.
>
> I'm not sure this is will ever happen, but to stay safe a better way
> would be to return an empty dict, like this:
>
> { "return": {} }
>
> Which can be read as 'command succeeded, but didn't return any data'.
>
> As the release is not done yet we still can change it, is anyone against?
That's fine by me. libvirt merely checks for whether 'error' vs 'return'
exist when first deciding whether it has been successful. We only look at
the contents of the 'return' key for commands expecting actual data back.
Regards,
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Qemu-devel] QMP's success response
2009-12-17 17:41 [Qemu-devel] QMP's success response Luiz Capitulino
2009-12-17 17:46 ` [Qemu-devel] " Daniel P. Berrange
@ 2009-12-17 18:32 ` Markus Armbruster
2009-12-17 19:09 ` Jamie Lokier
2 siblings, 0 replies; 5+ messages in thread
From: Markus Armbruster @ 2009-12-17 18:32 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: aliguori, qemu-devel, avi
Luiz Capitulino <lcapitulino@redhat.com> writes:
> Hi there,
>
> Currently, when a regular command doesn't have any data to output,
> QMP will emit:
>
> { "return": "OK" }
>
> I thought this was a good idea because it has a clear meaning. Silly me,
> this is optimized for humans, but for machines it introduces the problem
> that such commands can't be changed to return values.
>
> I'm not sure this is will ever happen, but to stay safe a better way
> would be to return an empty dict, like this:
>
> { "return": {} }
>
> Which can be read as 'command succeeded, but didn't return any data'.
>
> As the release is not done yet we still can change it, is anyone against?
I'm very much in favor of it.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Qemu-devel] QMP's success response
2009-12-17 17:41 [Qemu-devel] QMP's success response Luiz Capitulino
2009-12-17 17:46 ` [Qemu-devel] " Daniel P. Berrange
2009-12-17 18:32 ` [Qemu-devel] " Markus Armbruster
@ 2009-12-17 19:09 ` Jamie Lokier
2009-12-17 19:19 ` Luiz Capitulino
2 siblings, 1 reply; 5+ messages in thread
From: Jamie Lokier @ 2009-12-17 19:09 UTC (permalink / raw)
To: Luiz Capitulino; +Cc: aliguori, avi, qemu-devel, armbru
Luiz Capitulino wrote:
>
> Hi there,
>
> Currently, when a regular command doesn't have any data to output,
> QMP will emit:
>
> { "return": "OK" }
>
> I thought this was a good idea because it has a clear meaning. Silly me,
> this is optimized for humans, but for machines it introduces the problem
> that such commands can't be changed to return values.
>
> I'm not sure this is will ever happen, but to stay safe a better way
> would be to return an empty dict, like this:
>
> { "return": {} }
Logically, it would be { "return": null }. What if future return
value is actually an empty dict? ;-) E.g. from an enumeration command,
where the enumerated set is empty.
-- Jamie
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [Qemu-devel] QMP's success response
2009-12-17 19:09 ` Jamie Lokier
@ 2009-12-17 19:19 ` Luiz Capitulino
0 siblings, 0 replies; 5+ messages in thread
From: Luiz Capitulino @ 2009-12-17 19:19 UTC (permalink / raw)
To: Jamie Lokier; +Cc: aliguori, avi, qemu-devel, armbru
On Thu, 17 Dec 2009 19:09:18 +0000
Jamie Lokier <jamie@shareable.org> wrote:
> Luiz Capitulino wrote:
> >
> > Hi there,
> >
> > Currently, when a regular command doesn't have any data to output,
> > QMP will emit:
> >
> > { "return": "OK" }
> >
> > I thought this was a good idea because it has a clear meaning. Silly me,
> > this is optimized for humans, but for machines it introduces the problem
> > that such commands can't be changed to return values.
> >
> > I'm not sure this is will ever happen, but to stay safe a better way
> > would be to return an empty dict, like this:
> >
> > { "return": {} }
>
> Logically, it would be { "return": null }.
In practice it brings the same problem.
> What if future return value is actually an empty dict? ;-)
This is compatible and has the same end result.
> E.g. from an enumeration command, where the enumerated set is empty.
Either, the command could return the empty dict or a dict
containing a "enum" key, which would be emitted like:
{ "result": { "enum": {} } }
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-12-17 19:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-17 17:41 [Qemu-devel] QMP's success response Luiz Capitulino
2009-12-17 17:46 ` [Qemu-devel] " Daniel P. Berrange
2009-12-17 18:32 ` [Qemu-devel] " Markus Armbruster
2009-12-17 19:09 ` Jamie Lokier
2009-12-17 19:19 ` Luiz Capitulino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).