From patchwork Thu Feb 4 14:24:41 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 44496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CEC76B7D52 for ; Fri, 5 Feb 2010 01:27:43 +1100 (EST) Received: from localhost ([127.0.0.1]:38987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nd2gG-0002qw-HZ for incoming@patchwork.ozlabs.org; Thu, 04 Feb 2010 09:27:40 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nd2de-00016X-Ai for qemu-devel@nongnu.org; Thu, 04 Feb 2010 09:24:58 -0500 Received: from [199.232.76.173] (port=54658 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nd2dd-00015j-GV for qemu-devel@nongnu.org; Thu, 04 Feb 2010 09:24:57 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nd2db-0008G7-O4 for qemu-devel@nongnu.org; Thu, 04 Feb 2010 09:24:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8599) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nd2db-0008G1-B8 for qemu-devel@nongnu.org; Thu, 04 Feb 2010 09:24:55 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o14EOsRK024966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Feb 2010 09:24:54 -0500 Received: from localhost (vpn-9-202.rdu.redhat.com [10.11.9.202]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o14EOqol018127; Thu, 4 Feb 2010 09:24:53 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 4 Feb 2010 12:24:41 -0200 Message-Id: <1265293484-30677-2-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1265293484-30677-1-git-send-email-lcapitulino@redhat.com> References: <1265293484-30677-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 1/4] QMP: Add QEMU's version to the greeting message X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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..47b0050 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_gretting(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_gretting(); assert(data != NULL); monitor_json_emitter(mon, data);