From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60598) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaJmS-0003hT-Lw for qemu-devel@nongnu.org; Fri, 11 Sep 2015 04:34:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZaJmP-0000Gm-Vc for qemu-devel@nongnu.org; Fri, 11 Sep 2015 04:34:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZaJmP-0000G3-Qo for qemu-devel@nongnu.org; Fri, 11 Sep 2015 04:33:57 -0400 Date: Fri, 11 Sep 2015 09:33:53 +0100 From: "Daniel P. Berrange" Message-ID: <20150911083353.GA21525@redhat.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87mvwtzbew.fsf@blackfin.pond.sub.org> Subject: Re: [Qemu-devel] [PATCH RFC v5 30/32] qapi: New QMP command query-qmp-schema for QMP introspection Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Michael Roth , qemu-devel@nongnu.org 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. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|