From nobody Sun Oct 5 19:22:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519934796628771.1870568083384; Thu, 1 Mar 2018 12:06:36 -0800 (PST) Received: from localhost ([::1]:59068 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erUTL-0004KB-KC for importer@patchew.org; Thu, 01 Mar 2018 15:06:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erU7g-0001bN-5V for qemu-devel@nongnu.org; Thu, 01 Mar 2018 14:44:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erU7f-0000Jb-2k for qemu-devel@nongnu.org; Thu, 01 Mar 2018 14:44:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56350) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1erU7e-0000Id-IM for qemu-devel@nongnu.org; Thu, 01 Mar 2018 14:44:10 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA6C062E90 for ; Thu, 1 Mar 2018 19:44:09 +0000 (UTC) Received: from red.redhat.com (ovpn-122-122.rdu2.redhat.com [10.10.122.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38196620A8; Thu, 1 Mar 2018 19:44:09 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 1 Mar 2018 13:42:42 -0600 Message-Id: <20180301194245.29854-28-eblake@redhat.com> In-Reply-To: <20180301194245.29854-1-eblake@redhat.com> References: <20180301194245.29854-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 01 Mar 2018 19:44:09 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 27/30] docs: Correct outdated information on QAPI X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Markus Armbruster * Fix guidance on error classes * Point to generated documentation * Drop plea for documentation, because the QAPI code generator enforces it since commit 3313b6124b * Minor tweaks here and there Signed-off-by: Markus Armbruster Message-Id: <20180211093607.27351-27-armbru@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Michael Roth Signed-off-by: Eric Blake --- docs/devel/writing-qmp-commands.txt | 25 +++++++++---------------- docs/interop/qmp-intro.txt | 3 ++- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/docs/devel/writing-qmp-commands.txt b/docs/devel/writing-qmp-c= ommands.txt index 776b3b41ca0..50385eff27c 100644 --- a/docs/devel/writing-qmp-commands.txt +++ b/docs/devel/writing-qmp-commands.txt @@ -36,9 +36,9 @@ very simple and get more complex as we progress. For all the examples in the next sections, the test setup is the same and = is shown here. -First, QEMU should be started as: +First, QEMU should be started like this: -# /path/to/your/source/qemu [...] \ +# qemu-system-TARGET [...] \ -chardev socket,id=3Dqmp,port=3D4444,host=3Dlocalhost,server \ -mon chardev=3Dqmp,mode=3Dcontrol,pretty=3Don @@ -179,7 +179,7 @@ described in the "Testing" section and then send two co= mmands: } } -You should see "Hello, world" and "we love qemu" in the terminal running q= emu, +You should see "Hello, world" and "We love qemu" in the terminal running q= emu, if you don't see these strings, then something went wrong. =3D=3D=3D Errors =3D=3D=3D @@ -221,30 +221,23 @@ The QMP server's response should be: } } -As a general rule, all QMP errors should use ERROR_CLASS_GENERIC_ERROR -(done by default when using error_setg()). There are two exceptions to -this rule: +Note that error_setg() produces a "GenericError" class. In general, +all QMP errors should have that error class. There are two exceptions +to this rule: - 1. A non-generic ErrorClass value exists* for the failure you want to rep= ort - (eg. DeviceNotFound) + 1. To support a management application's need to recognize a specific + error for special handling - 2. Management applications have to take special action on the failure you - want to report, hence you have to add a new ErrorClass value so that t= hey - can check for it + 2. Backward compatibility If the failure you want to report falls into one of the two cases above, use error_set() with a second argument of an ErrorClass value. - * All existing ErrorClass values are defined in the qapi-schema.json file - =3D=3D=3D Command Documentation =3D=3D=3D There's only one step missing to make "hello-world"'s implementation compl= ete, and that's its documentation in the schema file. -This is very important. No QMP command will be accepted in QEMU without pr= oper -documentation. - There are many examples of such documentation in the schema file already, = but here goes "hello-world"'s new entry for qapi/misc.json: diff --git a/docs/interop/qmp-intro.txt b/docs/interop/qmp-intro.txt index adbc94abb1d..430fe1b7472 100644 --- a/docs/interop/qmp-intro.txt +++ b/docs/interop/qmp-intro.txt @@ -78,7 +78,8 @@ Escape character is '^]'. } } -Please, refer to the qapi-schema.json file for a complete command referenc= e. +Please refer to docs/interop/qemu-qmp-ref.* for a complete command +reference, generated from qapi-schema.json. QMP wiki page ------------- --=20 2.14.3