qemu-devel.nongnu.org archive mirror
 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

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