qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2] qmp: return err msg when powerdown a vm when it


From: Qinghua Jin
Subject: [Qemu-devel] [PATCH v2] qmp: return err msg when powerdown a vm when it isn't in running state
Date: Tue, 22 Dec 2015 09:42:14 +0800

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 <address@hidden>
---
 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]