qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Chen Hanxiao <chen_han_xiao@126.com>
To: Luiz Capitulino <lcapitulino@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	eblake@redhat.com
Cc: qemu-devel@nongnu.org, Chen Hanxiao <chen_han_xiao@126.com>
Subject: [Qemu-devel]  [PATCH v2 1/2] qmp: add support for system_suspend
Date: Sat, 28 Nov 2015 11:01:45 +0800	[thread overview]
Message-ID: <1448679706-23771-2-git-send-email-chen_han_xiao@126.com> (raw)
In-Reply-To: <1448679706-23771-1-git-send-email-chen_han_xiao@126.com>

From: Chen Hanxiao <chenhanxiao@gmail.com>

This patch add support for system_suspend qmp command.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
---
 qapi-schema.json |  9 +++++++++
 qmp-commands.hx  | 21 +++++++++++++++++++++
 qmp.c            |  5 +++++
 3 files changed, 35 insertions(+)

diff --git a/qapi-schema.json b/qapi-schema.json
index 8b1a423..78bbb29 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3971,3 +3971,12 @@
 ##
 { 'enum': 'ReplayMode',
   'data': [ 'none', 'record', 'play' ] }
+
+##
+# @system_suspend:
+#
+# Performs suspend operation of a guest.
+#
+# Since: 2.5
+##
+{ 'command': 'system_suspend' }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 9d8b42f..4edb8bc 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -251,6 +251,27 @@ Example:
 EQMP
 
     {
+        .name       = "system_suspend",
+        .args_type  = "",
+        .mhandler.cmd_new = qmp_marshal_system_suspend,
+    },
+
+SQMP
+system_suspend
+----------------
+
+Send system suspend event.
+
+Arguments: None.
+
+Example:
+
+-> { "execute": "system_suspend" }
+<- { "return": {} }
+
+EQMP
+
+    {
         .name       = "system_powerdown",
         .args_type  = "",
         .mhandler.cmd_new = qmp_marshal_system_powerdown,
diff --git a/qmp.c b/qmp.c
index 0a1fa19..408e418 100644
--- a/qmp.c
+++ b/qmp.c
@@ -119,6 +119,11 @@ void qmp_system_powerdown(Error **erp)
     qemu_system_powerdown_request();
 }
 
+void qmp_system_suspend(Error **erp)
+{
+    qemu_system_suspend_request();
+}
+
 void qmp_cpu(int64_t index, Error **errp)
 {
     /* Just do nothing */
-- 
1.9.3

  reply	other threads:[~2015-11-28  3:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-28  3:01 [Qemu-devel] [PATCH v2 0/2] qmp/hmp: add support for system_suspend Chen Hanxiao
2015-11-28  3:01 ` Chen Hanxiao [this message]
2015-11-30 18:10   ` [Qemu-devel] [PATCH v2 1/2] qmp: " Eric Blake
2015-12-01 14:41     ` Chen Hanxiao
2015-11-28  3:01 ` [Qemu-devel] [PATCH v2 2/2] hmp: " Chen Hanxiao
2015-11-30 18:12   ` Eric Blake

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=1448679706-23771-2-git-send-email-chen_han_xiao@126.com \
    --to=chen_han_xiao@126.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=lcapitulino@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).