From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, armbru@redhat.com
Subject: [Qemu-devel] [PATCH 1/4] QMP: Add QEMU's version to the greeting message
Date: Thu, 4 Feb 2010 18:10:04 -0200 [thread overview]
Message-ID: <1265314207-6323-2-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1265314207-6323-1-git-send-email-lcapitulino@redhat.com>
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 <lcapitulino@redhat.com>
---
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);
--
1.6.6
next prev parent reply other threads:[~2010-02-04 20:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-04 20:10 [Qemu-devel] [PATCH v2 0/4]: QMP capability negotiation support Luiz Capitulino
2010-02-04 20:10 ` Luiz Capitulino [this message]
2010-02-10 19:29 ` [Qemu-devel] [PATCH 1/4] QMP: Add QEMU's version to the greeting message Anthony Liguori
2010-02-04 20:10 ` [Qemu-devel] [PATCH 2/4] QMP: Introduce the qmp_capabilities command Luiz Capitulino
2010-02-04 20:10 ` [Qemu-devel] [PATCH 3/4] QMP: Enforce capability negotiation rules Luiz Capitulino
2010-02-04 20:10 ` [Qemu-devel] [PATCH 4/4] QMP: spec: Capability negotiation updates Luiz Capitulino
2010-02-05 9:08 ` [Qemu-devel] [PATCH v2 0/4]: QMP capability negotiation support Markus Armbruster
-- strict thread matches above, loose matches on Subject: below --
2010-02-04 14:24 [Qemu-devel] [PATCH v1 " Luiz Capitulino
2010-02-04 14:24 ` [Qemu-devel] [PATCH 1/4] QMP: Add QEMU's version to the greeting message Luiz Capitulino
2010-02-04 16:32 ` Markus Armbruster
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=1265314207-6323-2-git-send-email-lcapitulino@redhat.com \
--to=lcapitulino@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@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 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).