From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NLLt9-00061q-NT for qemu-devel@nongnu.org; Thu, 17 Dec 2009 14:19:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NLLt5-0005vy-P9 for qemu-devel@nongnu.org; Thu, 17 Dec 2009 14:19:51 -0500 Received: from [199.232.76.173] (port=56569 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NLLt5-0005vh-Js for qemu-devel@nongnu.org; Thu, 17 Dec 2009 14:19:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:18933) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NLLt4-0001RB-Sb for qemu-devel@nongnu.org; Thu, 17 Dec 2009 14:19:47 -0500 Date: Thu, 17 Dec 2009 17:19:27 -0200 From: Luiz Capitulino Subject: Re: [Qemu-devel] QMP's success response Message-ID: <20091217171927.0aa4d242@doriath> In-Reply-To: <20091217190918.GB362@shareable.org> References: <20091217154147.22845395@doriath> <20091217190918.GB362@shareable.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jamie Lokier Cc: aliguori@linux.vnet.ibm.com, avi@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com On Thu, 17 Dec 2009 19:09:18 +0000 Jamie Lokier 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": {} } }