From patchwork Fri Mar 11 23:05:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 86470 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 843B0B6F9D for ; Sat, 12 Mar 2011 10:16:27 +1100 (EST) Received: from localhost ([127.0.0.1]:52289 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PyBV9-0006t7-Vi for incoming@patchwork.ozlabs.org; Fri, 11 Mar 2011 18:12:08 -0500 Received: from [140.186.70.92] (port=54652 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PyBPI-0004Ah-B3 for qemu-devel@nongnu.org; Fri, 11 Mar 2011 18:06:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PyBPH-0006xb-BK for qemu-devel@nongnu.org; Fri, 11 Mar 2011 18:06:04 -0500 Received: from e5.ny.us.ibm.com ([32.97.182.145]:48562) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PyBPH-0006xT-8n for qemu-devel@nongnu.org; Fri, 11 Mar 2011 18:06:03 -0500 Received: from d01dlp02.pok.ibm.com (d01dlp02.pok.ibm.com [9.56.224.85]) by e5.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p2BMf6jB011028 for ; Fri, 11 Mar 2011 17:41:06 -0500 Received: from d01relay03.pok.ibm.com (d01relay03.pok.ibm.com [9.56.227.235]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id D9D7B6E8040 for ; Fri, 11 Mar 2011 18:06:02 -0500 (EST) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay03.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2BN620G240854 for ; Fri, 11 Mar 2011 18:06:02 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2BN62Bp027881 for ; Fri, 11 Mar 2011 18:06:02 -0500 Received: from localhost.localdomain (sig-9-65-217-31.mts.ibm.com [9.65.217.31]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p2BN5lGv026958; Fri, 11 Mar 2011 18:06:01 -0500 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Fri, 11 Mar 2011 17:05:40 -0600 Message-Id: <1299884745-521-11-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1299884745-521-1-git-send-email-aliguori@us.ibm.com> References: <1299884745-521-1-git-send-email-aliguori@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 32.97.182.145 Cc: Adam Litke , Anthony Liguori , Luiz Capitulino , Avi Kivity , Markus Armbruster Subject: [Qemu-devel] [PATCH 10/15] qapi: add QMP quit command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This is needed by the test suite. Signed-off-by: Anthony Liguori diff --git a/qmp-schema.json b/qmp-schema.json index e72bc18..d19cf73 100644 --- a/qmp-schema.json +++ b/qmp-schema.json @@ -88,3 +88,15 @@ # Since: 0.14.0 ## { 'command': 'query-version', 'returns': 'VersionInfo' } + +## +# @quit: +# +# This command will cause the QEMU process to exit gracefully. While every +# attempt is made to send the QMP response before terminating, this is not +# guaranteed. When using this interface, a premature EOF would not be +# unexpected. +# +# Since: 0.14.0 +## +{ 'command': 'quit' } diff --git a/qmp.c b/qmp.c index 7b626f5..837ac95 100644 --- a/qmp.c +++ b/qmp.c @@ -12,6 +12,7 @@ #include "qemu-common.h" #include "qmp-core.h" #include "qmp.h" +#include "sysemu.h" VersionInfo *qmp_query_version(Error **err) { @@ -29,3 +30,8 @@ VersionInfo *qmp_query_version(Error **err) return info; } +void qmp_quit(Error **err) +{ + no_shutdown = 0; + qemu_system_shutdown_request(); +}