qmp/hmp: add support for system_suspend
v2 cover qmp/hmp: add support for system_suspend
From: Chen Hanxiao <[email protected]>
Chen Hanxiao (2):
qmp: add support for system_suspend
hmp: add support for system_suspend
hmp-commands.hx | 14 ++++++++++++++ hmp.c | 5 +++++ hmp.h | 1 + qapi-schema.json | 9 +++++++++ qmp-commands.hx | 21 +++++++++++++++++++++ qmp.c | 5 +++++ 6 files changed, 55 insertions(+)
Signature · 1 line
1.9.3
PATCH v2 1/2 qmp: add support for system_suspend
From: Chen Hanxiao <[email protected]>
This patch add support for system_suspend qmp command.
--- qapi-schema.json | 9 +++++++++ qmp-commands.hx | 21 +++++++++++++++++++++ qmp.c | 5 +++++ 3 files changed, 35 insertions(+)
qapi-schema.json +9 -0
@@ -3971,3 +3971,12 @@ ## { 'enum': 'ReplayMode', 'data': [ 'none', 'record', 'play' ] } + +## +# @system_suspend: +# +# Performs suspend operation of a guest. +# +# Since: 2.5 +## +{ 'command': 'system_suspend' }
qmp-commands.hx +21 -0
@@ -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,
qmp.c +5 -0
@@ -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
Re: [Qemu-devel] [PATCH v2 1/2] qmp: add support for system_suspend
Quoted 18 lines · Chen Hanxiao
From: Chen Hanxiao <[email protected]>
This patch add support for
system_suspendqmp command.Signed-off-by Chen Hanxiao <[email protected]>--- qapi-schema.json | 9 +++++++++ qmp-commands.hx | 21 +++++++++++++++++++++ qmp.c | 5 +++++ 3 files changed, 35 insertions(+)qapi-schema.json +0
-0@@ -3971,3 +3971,12 @@ ## { 'enum': 'ReplayMode',
qapi-schema.json line 3982
Quoted 10 lines
qapi-schema.json +9
-0'data': [ 'none', 'record', 'play' ] } + +## +# @system_suspend: +# +# Performs suspend operation of a guest. +# +# Since: 2.5 +## +{ 'command': 'system_suspend' }
You've missed 2.5; this should be since 2.6. Also, new QMP commands should be named with '-' rather than '_'; so this should be 'system-suspend'. (Yes, I know 'system_wakeup' already exists with the older spelling).
How does this command differ from the existing ability to use qemu-guest-agent to request the guest put itself into suspend state?
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Re: [Qemu-devel] [PATCH v2 1/2] qmp: add support for system_suspend
Quoted 34 lines · Eric Blake
Quoted 18 lines · Chen Hanxiao
From: Chen Hanxiao <[email protected]>
This patch add support for
system_suspendqmp command.Signed-off-by Chen Hanxiao <[email protected]>--- qapi-schema.json | 9 +++++++++ qmp-commands.hx | 21 +++++++++++++++++++++ qmp.c | 5 +++++ 3 files changed, 35 insertions(+)qapi-schema.json +0
-0@@ -3971,3 +3971,12 @@ ## { 'enum': 'ReplayMode',qapi-schema.json line 3982
Quoted 10 lines
qapi-schema.json +9
-0'data': [ 'none', 'record', 'play' ] } + +## +# @system_suspend: +# +# Performs suspend operation of a guest. +# +# Since: 2.5 +## +{ 'command': 'system_suspend' }You've missed 2.5; this should be since 2.6. Also, new QMP commands should be named with '-' rather than '_'; so this should be 'system-suspend'. (Yes, I know '
system_wakeup' already exists with the older spelling).
Quoted 3 lines
How does this command differ from the existing ability to use qemu-guest-agent to request the guest put itself into suspend state?
I tried to add a suspend hmp command which not existed. As your previous comment, I added this for qmp. It duplicates with current qga commands though.
So we just need that hmp patch with a qmp_system_suspend.
Regards,
- Chen
PATCH v2 2/2 hmp: add support for system_suspend
In reply to Chen HanxiaoFrom: Chen Hanxiao <[email protected]>
This patch add support for system_suspend hmp command.
--- hmp-commands.hx | 14 ++++++++++++++ hmp.c | 5 +++++ hmp.h | 1 + 3 files changed, 20 insertions(+)
hmp-commands.hx +14 -0
@@ -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
@@ -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
@@ -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);
Signature · 1 line
1.9.3
Re: [Qemu-devel] [PATCH v2 2/2] hmp: add support for system_suspend
Quoted 14 lines · Chen Hanxiao
From: Chen Hanxiao <[email protected]>
This patch add support for
system_suspendhmp command.Signed-off-by Chen Hanxiao <[email protected]>--- hmp-commands.hx | 14 ++++++++++++++ hmp.c | 5 +++++ hmp.h | 1 + 3 files changed, 20 insertions(+)+++
b/hmp.c
hmp.c void hmp_system_powerdown(Monitor *mon, const QDict *qdict) · line 890
Quoted 6 lines
hmp.c +3
-0@@ -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 );
Why are you ignoring any potential errors? Wouldn't it be better to report an error, if one occurs? Or at least pass &error_abort to assert that no error can occur (matching the current implementation in patch 1/2 that never fails).
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org