]> git.proxmox.com Git - mirror_qemu.git/commitdiff
QMP: Add QEMU's version to the greeting message
authorLuiz Capitulino <lcapitulino@redhat.com>
Thu, 4 Feb 2010 20:10:04 +0000 (18:10 -0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 10 Feb 2010 18:46:05 +0000 (12:46 -0600)
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>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
QMP/README
QMP/qmp-spec.txt
monitor.c

index 09e7053753c4ee92659fe205a9c1048276e563c7..9334c255108e476de462cb7c6d31b6370c8f4c7b 100644 (file)
@@ -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
 -------
index 56f388c3b33a1eac0945f6fb5e4788ded3a5e454..b2617bb2f09faa8074955da3636133441b822dcd 100644 (file)
@@ -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
 ---------------------------
index 19876adbc207eee847cd84bee81b6bd684c472f5..02829a439815d349ff07a098f0aad65967f689dd 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -4368,6 +4368,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
  */
@@ -4379,7 +4387,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);