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_...@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