Received: from eggs.gnu.org ([2001:4830:134:3::10]:39310) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaOPv-0006R2-Mk for qemu-devel@nongnu.org; Fri, 11 Sep 2015 09:31:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaOPr-0002Mg-Ly for qemu-devel@nongnu.org; Fri, 11 Sep 2015 09:31:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaOPr-0002MU-99 for qemu-devel@nongnu.org; Fri, 11 Sep 2015 09:30:59 -0400 From: Markus Armbruster References: <1441621003-2434-1-git-send-email-armbru@redhat.com> <1441621003-2434-31-git-send-email-armbru@redhat.com> <20150910221239.3885.6170@loki> <87mvwtzbew.fsf@blackfin.pond.sub.org> <20150911083353.GA21525@redhat.com> Date: Fri, 11 Sep 2015 15:30:55 +0200 In-Reply-To: <20150911083353.GA21525@redhat.com> (Daniel P. Berrange's message of "Fri, 11 Sep 2015 09:33:53 +0100") Message-ID: <87a8stqe0g.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH RFC v5 30/32] qapi: New QMP command query-qmp-schema for QMP introspection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Michael Roth , qemu-devel@nongnu.org "Daniel P. Berrange" writes: > On Fri, Sep 11, 2015 at 09:02:15AM +0200, Markus Armbruster wrote: >> Michael Roth writes: >> >> > Quoting Markus Armbruster (2015-09-07 05:16:41) >> >> A new test-qmp-input-visitor test case feeds its result for both >> >> tests/qapi-schema/qapi-schema-test.json and qapi-schema.json to a >> >> QmpInputVisitor to verify it actually conforms to the schema. >> >> >> >> New QMP command query-qmp-schema takes its return value from that >> >> variable. Its reply is some 85KiBytes for me right now. >> >> >> >> If this turns out to be too much, we have a couple of options: >> >> >> >> * We can use shorter names in the JSON. Not the QMP style. >> >> >> >> * Optionally return the sub-schema for commands and events given as >> >> arguments. >> >> >> >> Right now qmp_query_schema() sends the string literal computed by >> >> qmp-introspect.py. To compute sub-schema at run time, we'd have to >> >> duplicate parts of qapi-introspect.py in C. Unattractive. >> >> >> >> * Let clients cache the output of query-qmp-schema. >> >> >> >> It changes only on QEMU upgrades, i.e. rarely. Provide a command >> >> query-qmp-schema-hash. Clients can have a cache indexed by hash, >> >> and re-query the schema only when they don't have it cached. Even >> >> simpler: put the hash in the QMP greeting. >> > >> > Would probably be easier for management to build up their own structure >> > for querying caps, so I think a computed hash seems best. But I don't >> > think either is something that couldn't be added later if need be. >> >> I also think a hash is the way to go, and I'd like to provide one early, >> but I don't want to delay this series for it. > > FWIW, libvirt already caches the results of its query of QEMU and will > only re-query QEMU if the timestamp of the QEMU binary on disk has > changed, or if libvirt itself has changed. Also when querying the QEMU > capabilities there are quite a few commands we run, we want to cache > the full set, not just query-qmp-schema, so we can avoid launching QEMU > at all. o at least from Libvirt's POV, I don't think we have a need for > a hash of query-qmp-schema. Noted.