All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qmp: return err msg when powerdown a vm when it isn't in running state
@ 2015-12-21 15:16 Qinghua Jin
  2015-12-21 17:55 ` P J P
  0 siblings, 1 reply; 3+ messages in thread
From: Qinghua Jin @ 2015-12-21 15:16 UTC (permalink / raw)
  To: qemu-devel; +Cc: Qinghua Jin, Markus Armbruster

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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/qmp.c b/qmp.c
index 0a1fa19..8e43435 100644
--- a/qmp.c
+++ b/qmp.c
@@ -114,8 +114,12 @@ void qmp_system_reset(Error **errp)
     qemu_system_reset_request();
 }
 
-void qmp_system_powerdown(Error **erp)
+void qmp_system_powerdown(Error **errp)
 {
+    if (!runstate_is_running()) {
+        error_setg(errp, "Can't powerdown the Virtual Machine when it isn't running");
+        return;
+    }
     qemu_system_powerdown_request();
 }
 
-- 
2.5.0

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

* Re: [Qemu-devel] [PATCH] qmp: return err msg when powerdown a vm when it isn't in running state
  2015-12-21 15:16 [Qemu-devel] [PATCH] qmp: return err msg when powerdown a vm when it isn't in running state Qinghua Jin
@ 2015-12-21 17:55 ` P J P
  2015-12-21 23:10   ` Qinghua Jin
  0 siblings, 1 reply; 3+ messages in thread
From: P J P @ 2015-12-21 17:55 UTC (permalink / raw)
  To: Qinghua Jin; +Cc: qemu-devel, Markus Armbruster

+-- On Mon, 21 Dec 2015, Qinghua Jin wrote --+
| -void qmp_system_powerdown(Error **erp)
| +void qmp_system_powerdown(Error **errp)
|  {
| +    if (!runstate_is_running()) {
| +        error_setg(errp, "Can't powerdown the Virtual Machine when it isn't running");
| +        return;
| +    }
|      qemu_system_powerdown_request();
|  }

 - Maybe direct call to 'if (!runstate_check(RUN_STATE_RUNNING))' is better?  
   runstate_is_running too invokes the same. Not sure why are there two
   functions 'runstate_is_running' & 'runstate_check'.
 - Can't -> Can not
 - "...the Virtual Machine.." -> "...virtual machine.." (not capitalised)
 - "...when it isn't.." -> "as it is not..."
 - OR maybe just say -> "Virtual machine is not running"

--
Prasad J Pandit / Red Hat Product Security Team
47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F

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

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

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

Thanks for your help, i'll resubmit the patch right away.


At 2015-12-22 01:55:35, "P J P" <ppandit@redhat.com> wrote:
>+-- On Mon, 21 Dec 2015, Qinghua Jin wrote --+
>| -void qmp_system_powerdown(Error **erp)
>| +void qmp_system_powerdown(Error **errp)
>|  {
>| +    if (!runstate_is_running()) {
>| +        error_setg(errp, "Can't powerdown the Virtual Machine when it isn't running");
>| +        return;
>| +    }
>|      qemu_system_powerdown_request();
>|  }
>
> - Maybe direct call to 'if (!runstate_check(RUN_STATE_RUNNING))' is better?  
>   runstate_is_running too invokes the same. Not sure why are there two
>   functions 'runstate_is_running' & 'runstate_check'.
> - Can't -> Can not
> - "...the Virtual Machine.." -> "...virtual machine.." (not capitalised)
> - "...when it isn't.." -> "as it is not..."
> - OR maybe just say -> "Virtual machine is not running"
>
>--
>Prasad J Pandit / Red Hat Product Security Team
>47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F

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

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

end of thread, other threads:[~2015-12-21 23:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-21 15:16 [Qemu-devel] [PATCH] qmp: return err msg when powerdown a vm when it isn't in running state Qinghua Jin
2015-12-21 17:55 ` P J P
2015-12-21 23:10   ` Qinghua Jin

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.