diff mbox

[17/22] qapi: add QMP quit command

Message ID 1299460984-15849-18-git-send-email-aliguori@us.ibm.com
State New
Headers show

Commit Message

Anthony Liguori March 7, 2011, 1:22 a.m. UTC
This is needed by the test suite.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
diff mbox

Patch

diff --git a/qmp-schema.json b/qmp-schema.json
index b343f5e..0581e67 100644
--- a/qmp-schema.json
+++ b/qmp-schema.json
@@ -36,3 +36,15 @@ 
 # Since: 0.14.0
 ##
 [ 'query-version', {}, {}, 'VersionInfo' ]
+
+##
+# @quit:
+#
+# This command will cause the QEMU process to exit gracefully.  While every
+# attempt is made to send the QMP response before terminating, this is not
+# guaranteed.  When using this interface, a premature EOF would not be
+# unexpected.
+#
+# Since: 0.14.0
+##
+[ 'quit', {}, {}, 'none' ]
diff --git a/qmp.c b/qmp.c
index 7b626f5..837ac95 100644
--- a/qmp.c
+++ b/qmp.c
@@ -12,6 +12,7 @@ 
 #include "qemu-common.h"
 #include "qmp-core.h"
 #include "qmp.h"
+#include "sysemu.h"
 
 VersionInfo *qmp_query_version(Error **err)
 {
@@ -29,3 +30,8 @@  VersionInfo *qmp_query_version(Error **err)
     return info;
 }
 
+void qmp_quit(Error **err)
+{
+    no_shutdown = 0;
+    qemu_system_shutdown_request();
+}