From: Qinghua Jin <qhjin_dev@163.com>
To: qemu-devel@nongnu.org
Cc: Qinghua Jin <qhjin_dev@163.com>, Fam Zheng <famz@redhat.com>,
Markus Armbruster <armbru@redhat.com>, P J P <ppandit@redhat.com>
Subject: [Qemu-devel] [PATCH v3] qmp: return err msg when powerdown a vm when it isn't in running state
Date: Tue, 22 Dec 2015 11:09:31 +0800 [thread overview]
Message-ID: <1450753771-5666-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>
---
This is an update of the patch as per Fam Zheng's suggestion:
http://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03949.html
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
next reply other threads:[~2015-12-22 3:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-22 3:09 Qinghua Jin [this message]
2015-12-22 6:54 ` [Qemu-devel] [PATCH v3] qmp: return err msg when powerdown a vm when it isn't in running state P J P
2016-01-18 13:50 ` Markus Armbruster
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=1450753771-5666-1-git-send-email-qhjin_dev@163.com \
--to=qhjin_dev@163.com \
--cc=armbru@redhat.com \
--cc=famz@redhat.com \
--cc=ppandit@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).