qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Qinghua Jin <qhjin_dev@163.com>
To: qemu-devel@nongnu.org
Cc: Qinghua Jin <qhjin_dev@163.com>, Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH] qmp: return err msg when powerdown a vm when it isn't in running state
Date: Mon, 21 Dec 2015 23:16:07 +0800	[thread overview]
Message-ID: <1450710967-24399-1-git-send-email-qhjin_dev@163.com> (raw)

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

             reply	other threads:[~2015-12-21 15:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21 15:16 Qinghua Jin [this message]
2015-12-21 17:55 ` [Qemu-devel] [PATCH] qmp: return err msg when powerdown a vm when it isn't in running state P J P
2015-12-21 23:10   ` Qinghua Jin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450710967-24399-1-git-send-email-qhjin_dev@163.com \
    --to=qhjin_dev@163.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).