From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W86dM-0006bm-Et for qemu-devel@nongnu.org; Tue, 28 Jan 2014 06:15:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W86dE-0006MK-1z for qemu-devel@nongnu.org; Tue, 28 Jan 2014 06:15:12 -0500 Received: from mail-qc0-x236.google.com ([2607:f8b0:400d:c01::236]:64621) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W86dD-0006LX-UN for qemu-devel@nongnu.org; Tue, 28 Jan 2014 06:15:04 -0500 Received: by mail-qc0-f182.google.com with SMTP id c9so287780qcz.13 for ; Tue, 28 Jan 2014 03:15:03 -0800 (PST) Sender: Paolo Bonzini Message-ID: <52E79132.1030705@redhat.com> Date: Tue, 28 Jan 2014 12:14:58 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1390488396-16538-1-git-send-email-akong@redhat.com> <1390488396-16538-5-git-send-email-akong@redhat.com> <20140124104831.GA11239@T430.nay.redhat.com> <20140127081756.GB2572@amosk.info> <52E62910.5050303@redhat.com> <20140127104631.GA13148@T430.redhat.com> <20140128104547.GA24312@amosk.info> In-Reply-To: <20140128104547.GA24312@amosk.info> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 4/5] qmp: full introspection support for QMP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amos Kong , Fam Zheng Cc: mdroth@linux.vnet.ibm.com, libvir-list@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, qiaonuohan@cn.fujitsu.com, xiawenc@linux.vnet.ibm.com Il 28/01/2014 11:45, Amos Kong ha scritto: > > My question is why is this generate-and-parse necessary? > > It's request of Libvirt, actually we can directly return the raw > schema to Libvirt without extending/parsing, then Libvirt parse > by itself. > > > Can we achieve it with less duplication? > > Let's see the feedback of Eric. Eric's feedback is certainly useful, but I think we need to look at it from the QEMU perspective more than the libvirt perspective. Passing the raw schema and letting libvirt parse it is a Really Bad idea from the QEMU perspective, in my opinion, even if it means a little more work now and even if libvirt is willing to add the parser. First and foremost, the current "pseudo-JSON" encoding of the schema is nothing but a QEMU implementation detail. The "pseudo-JSON" syntax definitely shouldn't percolate to the QAPI documentation. Using normal QAPI structs means that the normal tool for documentation (qapi-schema.json doc comments) applies just as well to QAPI schema introspection Second, if one day we were to change the schema representation from "pseudo-JSON" to something else, we would have to carry a "pseudo-JSON" serializer for backwards compatibility. Building QAPI structs and relying on the normal formatting machinery is very different from putting together strings manually. The schema must be emitted as JSON data, not as a string. I'm not willing to compromise on this point. :) Paolo