All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/2] qmp/hmp: add support for system_suspend
@ 2015-11-28  3:01 Chen Hanxiao
  2015-11-28  3:01 ` [Qemu-devel] [PATCH v2 1/2] qmp: " Chen Hanxiao
  2015-11-28  3:01 ` [Qemu-devel] [PATCH v2 2/2] hmp: " Chen Hanxiao
  0 siblings, 2 replies; 6+ messages in thread
From: Chen Hanxiao @ 2015-11-28  3:01 UTC (permalink / raw)
  To: Luiz Capitulino, Markus Armbruster, eblake; +Cc: qemu-devel, Chen Hanxiao

From: Chen Hanxiao <chenhanxiao@gmail.com>

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(+)

-- 
1.9.3

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

* [Qemu-devel]  [PATCH v2 1/2] qmp: add support for system_suspend
  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
  2015-11-30 18:10   ` Eric Blake
  2015-11-28  3:01 ` [Qemu-devel] [PATCH v2 2/2] hmp: " Chen Hanxiao
  1 sibling, 1 reply; 6+ messages in thread
From: Chen Hanxiao @ 2015-11-28  3:01 UTC (permalink / raw)
  To: Luiz Capitulino, Markus Armbruster, eblake; +Cc: qemu-devel, Chen Hanxiao

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

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

* [Qemu-devel]  [PATCH v2 2/2] hmp: add support for system_suspend
  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 ` [Qemu-devel] [PATCH v2 1/2] qmp: " Chen Hanxiao
@ 2015-11-28  3:01 ` Chen Hanxiao
  2015-11-30 18:12   ` Eric Blake
  1 sibling, 1 reply; 6+ messages in thread
From: Chen Hanxiao @ 2015-11-28  3:01 UTC (permalink / raw)
  To: Luiz Capitulino, Markus Armbruster, eblake; +Cc: qemu-devel, Chen Hanxiao

From: Chen Hanxiao <chenhanxiao@gmail.com>

This patch add support for system_suspend hmp command.

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
---
 hmp-commands.hx | 14 ++++++++++++++
 hmp.c           |  5 +++++
 hmp.h           |  1 +
 3 files changed, 20 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);
-- 
1.9.3

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

* Re: [Qemu-devel] [PATCH v2 1/2] qmp: add support for system_suspend
  2015-11-28  3:01 ` [Qemu-devel] [PATCH v2 1/2] qmp: " Chen Hanxiao
@ 2015-11-30 18:10   ` Eric Blake
  2015-12-01 14:41     ` Chen Hanxiao
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Blake @ 2015-11-30 18:10 UTC (permalink / raw)
  To: Chen Hanxiao, Luiz Capitulino, Markus Armbruster; +Cc: qemu-devel

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

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?

-- 
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] 6+ messages in thread

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

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

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

> +++ 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);

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

-- 
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] 6+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/2] qmp: add support for system_suspend
  2015-11-30 18:10   ` Eric Blake
@ 2015-12-01 14:41     ` Chen Hanxiao
  0 siblings, 0 replies; 6+ messages in thread
From: Chen Hanxiao @ 2015-12-01 14:41 UTC (permalink / raw)
  To: Eric Blake, Luiz Capitulino, Markus Armbruster; +Cc: qemu-devel


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

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

end of thread, other threads:[~2015-12-01 14:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [Qemu-devel] [PATCH v2 1/2] qmp: " Chen Hanxiao
2015-11-30 18:10   ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.