Skip to contentSkip to conversation

qmp/hmp: add support for system_suspend

PATCH Superseded Chen Hanxiao 2 participants 3 messages Nov 27, 2015 – Nov 28, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qmp/hmp: add support for system_suspend

From: Chen Hanxiao <[email protected]>

This patch add support for system_suspend command.

---
 hmp-commands.hx | 14 ++++++++++++++
 hmp.c           |  5 +++++
 hmp.h           |  1 +
 qmp.c           |  5 +++++
 4 files changed, 25 insertions(+)
hmp-commands.hx +14 -0
index bb52e4d..0ee9733 100644
@@ -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",
hmp.c +5 -0
index 2140605..de4a5f7 100644
@@ -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;
hmp.h +1 -0
index a8c5b5a..0064fa0 100644
@@ -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);
qmp.c +5 -0
index 0a1fa19..408e418 100644
@@ -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 */
Signature · 1 line
1.9.3
#1 lore raw
Quoted 11 lines · Chen Hanxiao

From: Chen Hanxiao <[email protected]>

This patch add support for system_suspend command.

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

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
Quoted 12 lines · Eric Blake
Quoted 11 lines · Chen Hanxiao

From: Chen Hanxiao <[email protected]>

This patch add support for system_suspend command.

---
  hmp-commands.hx | 14 ++++++++++++++
  hmp.c           |  5 +++++
  hmp.h           |  1 +
  qmp.c           |  5 +++++
  4 files changed, 25 insertions(+)
Quoted 3 lines

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