qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] qmp: return err msg when powerdown a vm when it isn't in running state
@ 2015-12-22  1:42 Qinghua Jin
  2015-12-22  2:06 ` Fam Zheng
  0 siblings, 1 reply; 3+ messages in thread
From: Qinghua Jin @ 2015-12-22  1:42 UTC (permalink / raw)
  To: qemu-devel; +Cc: Qinghua Jin, Markus Armbruster, P J P

This is an update of patch previously show in msg:

  http://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03817.html

When send system_powerdown to QMP when the vm isn't in RUN_STATE_RUNNING,
it will be ignored by system. So reply a err msg with the situation.

Signed-off-by: Qinghua Jin <qhjin_dev@163.com>
---
 qmp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/qmp.c b/qmp.c
index 0a1fa19..384df56 100644
--- a/qmp.c
+++ b/qmp.c
@@ -114,8 +114,13 @@ void qmp_system_reset(Error **errp)
     qemu_system_reset_request();
 }
 
-void qmp_system_powerdown(Error **erp)
+void qmp_system_powerdown(Error **errp)
 {
+    if (!runstate_check(RUN_STATE_RUNNING)) {
+        error_setg(errp,
+                   "Can not powerdown virtual machine as it is not running");
+        return;
+    }
     qemu_system_powerdown_request();
 }
 
-- 
2.5.0

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

* Re: [Qemu-devel] [PATCH v2] qmp: return err msg when powerdown a vm when it isn't in running state
  2015-12-22  1:42 [Qemu-devel] [PATCH v2] qmp: return err msg when powerdown a vm when it isn't in running state Qinghua Jin
@ 2015-12-22  2:06 ` Fam Zheng
  2015-12-22  2:40   ` Qinghua Jin
  0 siblings, 1 reply; 3+ messages in thread
From: Fam Zheng @ 2015-12-22  2:06 UTC (permalink / raw)
  To: Qinghua Jin; +Cc: P J P, qemu-devel, Markus Armbruster

On Tue, 12/22 09:42, Qinghua Jin wrote:
> This is an update of patch previously show in msg:
> 
>   http://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03817.html

The patch looks good to me, thanks for submitting the patch! There is only one
minor comment:

Patch revision note should go after the --- line (or the cover letter if you
have one) so that it won't be commited into the git log (because it wouldn't be
informative):

    When send system_powerdown to QMP when the vm isn't in RUN_STATE_RUNNING,
    it will be ignored by system. So reply a err msg with the situation.

    Signed-off-by: Qinghua Jin <qhjin_dev@163.com>
    ---

    This is an update of patch previously show in msg:

      http://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03817.html

     qmp.c | 7 ++++++-

> 
> When send system_powerdown to QMP when the vm isn't in RUN_STATE_RUNNING,
> it will be ignored by system. So reply a err msg with the situation.
> 
> Signed-off-by: Qinghua Jin <qhjin_dev@163.com>
> ---
>  qmp.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/qmp.c b/qmp.c
> index 0a1fa19..384df56 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -114,8 +114,13 @@ void qmp_system_reset(Error **errp)
>      qemu_system_reset_request();
>  }
>  
> -void qmp_system_powerdown(Error **erp)
> +void qmp_system_powerdown(Error **errp)
>  {
> +    if (!runstate_check(RUN_STATE_RUNNING)) {
> +        error_setg(errp,
> +                   "Can not powerdown virtual machine as it is not running");
> +        return;
> +    }
>      qemu_system_powerdown_request();
>  }
>  
> -- 
> 2.5.0
> 
> 
> 

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

* Re: [Qemu-devel] [PATCH v2] qmp: return err msg when powerdown a vm when it isn't in running state
  2015-12-22  2:06 ` Fam Zheng
@ 2015-12-22  2:40   ` Qinghua Jin
  0 siblings, 0 replies; 3+ messages in thread
From: Qinghua Jin @ 2015-12-22  2:40 UTC (permalink / raw)
  To: Fam Zheng; +Cc: P J P, qemu-devel, Markus Armbruster

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

Thanks for helping me, i'll use the patch format suggested by you.


At 2015-12-22 10:06:17, "Fam Zheng" <famz@redhat.com> wrote:
>On Tue, 12/22 09:42, Qinghua Jin wrote:
>> This is an update of patch previously show in msg:
>> 
>>   http://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03817.html
>
>The patch looks good to me, thanks for submitting the patch! There is only one
>minor comment:
>
>Patch revision note should go after the --- line (or the cover letter if you
>have one) so that it won't be commited into the git log (because it wouldn't be
>informative):
>
>    When send system_powerdown to QMP when the vm isn't in RUN_STATE_RUNNING,
>    it will be ignored by system. So reply a err msg with the situation.
>
>    Signed-off-by: Qinghua Jin <qhjin_dev@163.com>
>    ---
>
>    This is an update of patch previously show in msg:
>
>      http://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03817.html
>
>     qmp.c | 7 ++++++-
>
>> 
>> When send system_powerdown to QMP when the vm isn't in RUN_STATE_RUNNING,
>> it will be ignored by system. So reply a err msg with the situation.
>> 
>> Signed-off-by: Qinghua Jin <qhjin_dev@163.com>
>> ---
>>  qmp.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/qmp.c b/qmp.c
>> index 0a1fa19..384df56 100644
>> --- a/qmp.c
>> +++ b/qmp.c
>> @@ -114,8 +114,13 @@ void qmp_system_reset(Error **errp)
>>      qemu_system_reset_request();
>>  }
>>  
>> -void qmp_system_powerdown(Error **erp)
>> +void qmp_system_powerdown(Error **errp)
>>  {
>> +    if (!runstate_check(RUN_STATE_RUNNING)) {
>> +        error_setg(errp,
>> +                   "Can not powerdown virtual machine as it is not running");
>> +        return;
>> +    }
>>      qemu_system_powerdown_request();
>>  }
>>  
>> -- 
>> 2.5.0
>> 
>> 
>> 

[-- Attachment #2: Type: text/html, Size: 2280 bytes --]

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

end of thread, other threads:[~2015-12-22  2:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-22  1:42 [Qemu-devel] [PATCH v2] qmp: return err msg when powerdown a vm when it isn't in running state Qinghua Jin
2015-12-22  2:06 ` Fam Zheng
2015-12-22  2:40   ` Qinghua Jin

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