Message ID | 1448679706-23771-2-git-send-email-chen_han_xiao@126.com |
---|---|
State | New |
Headers | show |
On 11/27/2015 08:01 PM, Chen Hanxiao wrote: > 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' } 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?
On 12/01/2015 02:10 AM, Eric Blake wrote: > On 11/27/2015 08:01 PM, Chen Hanxiao wrote: >> 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' } > 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? > 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
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 */