summary refs log tree commit diff stats
path: root/qmp-commands.hx
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-05-21 17:59:51 +0100
committerLuiz Capitulino <lcapitulino@redhat.com>2012-06-04 13:49:35 -0300
commit4860853d60ecea44b65e9cdefce980de3a641dce (patch)
tree5577487a16c016864905dbd887a3f84be16db360 /qmp-commands.hx
parent5f96415527e4f25dc83cfc458c46e5bcbfee79ba (diff)
downloadfocaccia-qemu-4860853d60ecea44b65e9cdefce980de3a641dce.tar.gz
focaccia-qemu-4860853d60ecea44b65e9cdefce980de3a641dce.zip
Add 'query-events' command to QMP to query async events
Sometimes it is neccessary for an application to determine
whether a particular QMP event is available, so they can
decide whether to use compatibility code instead. This
introduces a new 'query-events' command to QMP to do just
that

 { "execute": "query-events" }
 {"return": [{"name": "WAKEUP"},
             {"name": "SUSPEND"},
             {"name": "DEVICE_TRAY_MOVED"},
             {"name": "BLOCK_JOB_CANCELLED"},
             {"name": "BLOCK_JOB_COMPLETED"},
             ...snip...
             {"name": "SHUTDOWN"}]}

* monitor.c: Turn MonitorEvent -> string conversion
  into a lookup from a static table of constant strings.
  Add impl of qmp_query_events monitor command handler
* qapi-schema.json, qmp-commands.hx: Define contract of
  query-events command

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'qmp-commands.hx')
-rw-r--r--qmp-commands.hx37
1 files changed, 37 insertions, 0 deletions
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 57ea803b14..2e1a38e695 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -1209,6 +1209,43 @@ EQMP
     },
 
 SQMP
+query-events
+--------------
+
+List QMP available events.
+
+Each event is represented by a json-object, the returned value is a json-array
+of all events.
+
+Each json-object contains:
+
+- "name": event's name (json-string)
+
+Example:
+
+-> { "execute": "query-events" }
+<- {
+      "return":[
+         {
+            "name":"SHUTDOWN"
+         },
+         {
+            "name":"RESET"
+         }
+      ]
+   }
+
+Note: This example has been shortened as the real response is too long.
+
+EQMP
+
+    {
+        .name       = "query-events",
+        .args_type  = "",
+        .mhandler.cmd_new = qmp_marshal_input_query_events,
+    },
+
+SQMP
 query-chardev
 -------------