diff mbox

[2/8] QMP: query-status: Introduce 'status' key

Message ID 1309889871-6267-3-git-send-email-lcapitulino@redhat.com
State New
Headers show

Commit Message

Luiz Capitulino July 5, 2011, 6:17 p.m. UTC
This new key reports the current VM status to clients. Please, check
the documentation being added in this commit for more details.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c       |    3 +--
 qmp-commands.hx |   17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index 1cb3191..00ebc8b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2584,8 +2584,7 @@  static void do_info_status_print(Monitor *mon, const QObject *data)
 
 static void do_info_status(Monitor *mon, QObject **ret_data)
 {
-    *ret_data = qobject_from_jsonf("{ 'running': %i, 'singlestep': %i }",
-                                    vm_running, singlestep);
+    *ret_data = qobject_from_jsonf("{ 'running': %i, 'singlestep': %i, 'status': %s }", vm_running, singlestep, vm_status_get_name());
 }
 
 static qemu_acl *find_acl(Monitor *mon, const char *name)
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 92c5c3a..6b8eb0a 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -1486,11 +1486,26 @@  Return a json-object with the following information:
 - "running": true if the VM is running, or false if it is paused (json-bool)
 - "singlestep": true if the VM is in single step mode,
                 false otherwise (json-bool)
+- "status": one of the following values (json-string)
+    "debug" - QEMU is running on a debugger
+    "inmigrate" - guest is paused waiting for an incoming migration
+    "postmigrate" - guest is paused following a successful 'migrate'
+    "internal-error" - An internal error that prevents further guest
+    execution has occurred
+    "load-state-error" - guest is paused following a failed 'loadvm'
+    "io-error" - the last IOP has failed and the device is configured 
+    to pause on I/O errors
+    "watchdog-error" - the watchdog action is configured to pause and 
+    "paused" - guest has been paused via the 'stop' command
+    "prelaunch" - QEMU was started with -S and guest has not started
+    "running" - guest is actively running
+    "shutdown" - guest is shut down (and -no-shutdown is in use)
+     has been triggered
 
 Example:
 
 -> { "execute": "query-status" }
-<- { "return": { "running": true, "singlestep": false } }
+<- { "return": { "running": true, "singlestep": false, "status": "running" } }
 
 EQMP