From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfIFp-00027W-FH for qemu-devel@nongnu.org; Wed, 10 Feb 2010 14:29:41 -0500 Received: from [199.232.76.173] (port=34102 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfIFp-00027O-4b for qemu-devel@nongnu.org; Wed, 10 Feb 2010 14:29:41 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfIFn-0005SV-CK for qemu-devel@nongnu.org; Wed, 10 Feb 2010 14:29:40 -0500 Received: from mail-iw0-f194.google.com ([209.85.223.194]:50447) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfIFn-0005SJ-2u for qemu-devel@nongnu.org; Wed, 10 Feb 2010 14:29:39 -0500 Received: by iwn32 with SMTP id 32so639299iwn.14 for ; Wed, 10 Feb 2010 11:29:38 -0800 (PST) Message-ID: <4B730920.2050103@codemonkey.ws> Date: Wed, 10 Feb 2010 13:29:36 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/4] QMP: Add QEMU's version to the greeting message References: <1265314207-6323-1-git-send-email-lcapitulino@redhat.com> <1265314207-6323-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1265314207-6323-2-git-send-email-lcapitulino@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com On 02/04/2010 02:10 PM, Luiz Capitulino wrote: > With capability negotiation support clients will only have a chance > to check QEMU's version (ie. issue 'query-version') after the > negotiation procedure is done. > > It might be useful to clients to check QEMU's version before > negotiating features, though. > > To allow that, this commit adds the QEMU's version object to the > greeting message. > > Not really sure this is needed, but doesn't hurt anyway. > > Signed-off-by: Luiz Capitulino > Applied all. Thanks. Regards, Anthony Liguori > --- > QMP/README | 6 ++++-- > QMP/qmp-spec.txt | 6 ++++-- > monitor.c | 10 +++++++++- > 3 files changed, 17 insertions(+), 5 deletions(-) > > diff --git a/QMP/README b/QMP/README > index 09e7053..9334c25 100644 > --- a/QMP/README > +++ b/QMP/README > @@ -52,9 +52,11 @@ $ telnet localhost 4444 > Trying 127.0.0.1... > Connected to localhost. > Escape character is '^]'. > -{"QMP": {"capabilities": []}} > +{"QMP": {"version": {"qemu": "0.12.50", "package": ""}, "capabilities": []}} > +{ "execute": "qmp_capabilities" } > +{"return": {}} > { "execute": "query-version" } > -{"return": {"qemu": "0.11.50", "package": ""}} > +{"return": {"qemu": "0.12.50", "package": ""}} > > Contact > ------- > diff --git a/QMP/qmp-spec.txt b/QMP/qmp-spec.txt > index 56f388c..b2617bb 100644 > --- a/QMP/qmp-spec.txt > +++ b/QMP/qmp-spec.txt > @@ -48,10 +48,12 @@ waiting for commands. > > The format is: > > -{ "QMP": { "capabilities": json-array } } > +{ "QMP": { "version": json-object, "capabilities": json-array } } > > Where, > > +- The "version" member contains the Server's version information (the format > + is the same of the 'query-version' command) > - The "capabilities" member specify the availability of features beyond the > baseline specification > > @@ -152,7 +154,7 @@ This section provides some examples of real QMP usage, in all of them > 3.1 Server greeting > ------------------- > > -S: {"QMP": {"capabilities": []}} > +S: {"QMP": {"version": {"qemu": "0.12.50", "package": ""}, "capabilities": []}} > > 3.2 Simple 'stop' execution > --------------------------- > diff --git a/monitor.c b/monitor.c > index ff22123..ec1d11e 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -4365,6 +4365,14 @@ void monitor_resume(Monitor *mon) > readline_show_prompt(mon->rs); > } > > +static QObject *get_qmp_greeting(void) > +{ > + QObject *ver; > + > + do_info_version(NULL,&ver); > + return qobject_from_jsonf("{'QMP':{'version': %p,'capabilities': []}}",ver); > +} > + > /** > * monitor_control_event(): Print QMP gretting > */ > @@ -4376,7 +4384,7 @@ static void monitor_control_event(void *opaque, int event) > > json_message_parser_init(&mon->mc->parser, handle_qmp_command); > > - data = qobject_from_jsonf("{ 'QMP': { 'capabilities': [] } }"); > + data = get_qmp_greeting(); > assert(data != NULL); > > monitor_json_emitter(mon, data); >