qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qmp/hmp: add support for system_suspend
@ 2015-11-27 15:15 Chen Hanxiao
  2015-11-27 17:53 ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Hanxiao @ 2015-11-27 15:15 UTC (permalink / raw)
  To: Luiz Capitulino, Markus Armbruster; +Cc: qemu-devel, Chen Hanxiao

From: Chen Hanxiao <chenhanxiao@gmail.com>

This patch add support for system_suspend command.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
---
 hmp-commands.hx | 14 ++++++++++++++
 hmp.c           |  5 +++++
 hmp.h           |  1 +
 qmp.c           |  5 +++++
 4 files changed, 25 insertions(+)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index bb52e4d..0ee9733 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -619,6 +619,20 @@ Power down the system (if supported).
 ETEXI
 
     {
+        .name       = "system_suspend",
+        .args_type  = "",
+        .params     = "",
+        .help       = "send system suspend event",
+        .mhandler.cmd = hmp_system_suspend,
+    },
+
+STEXI
+@item system_suspend
+@findex system_suspend
+Suspend the system (if supported).
+ETEXI
+
+    {
         .name       = "sum",
         .args_type  = "start:i,size:i",
         .params     = "addr size",
diff --git a/hmp.c b/hmp.c
index 2140605..de4a5f7 100644
--- a/hmp.c
+++ b/hmp.c
@@ -885,6 +885,11 @@ void hmp_system_powerdown(Monitor *mon, const QDict *qdict)
     qmp_system_powerdown(NULL);
 }
 
+void hmp_system_suspend(Monitor *mon, const QDict *qdict)
+{
+    qmp_system_suspend(NULL);
+}
+
 void hmp_cpu(Monitor *mon, const QDict *qdict)
 {
     int64_t cpu_index;
diff --git a/hmp.h b/hmp.h
index a8c5b5a..0064fa0 100644
--- a/hmp.h
+++ b/hmp.h
@@ -44,6 +44,7 @@ void hmp_quit(Monitor *mon, const QDict *qdict);
 void hmp_stop(Monitor *mon, const QDict *qdict);
 void hmp_system_reset(Monitor *mon, const QDict *qdict);
 void hmp_system_powerdown(Monitor *mon, const QDict *qdict);
+void hmp_system_suspend(Monitor *mon, const QDict *qdict);
 void hmp_cpu(Monitor *mon, const QDict *qdict);
 void hmp_memsave(Monitor *mon, const QDict *qdict);
 void hmp_pmemsave(Monitor *mon, const QDict *qdict);
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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] qmp/hmp: add support for system_suspend
  2015-11-27 15:15 [Qemu-devel] [PATCH] qmp/hmp: add support for system_suspend Chen Hanxiao
@ 2015-11-27 17:53 ` Eric Blake
  2015-11-28  2:44   ` Chen Hanxiao
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2015-11-27 17:53 UTC (permalink / raw)
  To: Chen Hanxiao, Luiz Capitulino, Markus Armbruster; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

On 11/27/2015 08:15 AM, Chen Hanxiao wrote:
> From: Chen Hanxiao <chenhanxiao@gmail.com>
> 
> This patch add support for system_suspend command.
> 
> Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
> ---
>  hmp-commands.hx | 14 ++++++++++++++
>  hmp.c           |  5 +++++
>  hmp.h           |  1 +
>  qmp.c           |  5 +++++
>  4 files changed, 25 insertions(+)

Generally, adding a function in qmp.c is accompanied by an addition in
qapi-schema.json to expose the function via QMP.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] qmp/hmp: add support for system_suspend
  2015-11-27 17:53 ` Eric Blake
@ 2015-11-28  2:44   ` Chen Hanxiao
  0 siblings, 0 replies; 3+ messages in thread
From: Chen Hanxiao @ 2015-11-28  2:44 UTC (permalink / raw)
  To: Eric Blake, Luiz Capitulino, Markus Armbruster; +Cc: qemu-devel


On 11/28/2015 01:53 AM, Eric Blake wrote:
> On 11/27/2015 08:15 AM, Chen Hanxiao wrote:
>> From: Chen Hanxiao <chenhanxiao@gmail.com>
>>
>> This patch add support for system_suspend command.
>>
>> Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
>> ---
>>   hmp-commands.hx | 14 ++++++++++++++
>>   hmp.c           |  5 +++++
>>   hmp.h           |  1 +
>>   qmp.c           |  5 +++++
>>   4 files changed, 25 insertions(+)
> Generally, adding a function in qmp.c is accompanied by an addition in
> qapi-schema.json to expose the function via QMP.
>
Sure, I'll post v2 for this.

Regards,
- Chen

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-28  2:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-27 15:15 [Qemu-devel] [PATCH] qmp/hmp: add support for system_suspend Chen Hanxiao
2015-11-27 17:53 ` Eric Blake
2015-11-28  2:44   ` Chen Hanxiao

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).