From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOwOQ-0006AC-Lm for qemu-devel@nongnu.org; Fri, 20 Feb 2015 17:49:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YOwOM-0006rm-KL for qemu-devel@nongnu.org; Fri, 20 Feb 2015 17:49:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:32934) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YOwOM-0006rg-CH for qemu-devel@nongnu.org; Fri, 20 Feb 2015 17:49:50 -0500 Message-ID: <54E7B9E1.80807@redhat.com> Date: Fri, 20 Feb 2015 15:49:05 -0700 From: Eric Blake MIME-Version: 1.0 References: <54E77042.8010207@redhat.com> <20150220190518.GA2917@igalia.com> In-Reply-To: <20150220190518.GA2917@igalia.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="eFiqhVoNrbUTDIDhjGgTMchapaTAgNNV7" Subject: Re: [Qemu-devel] [PATCH 0/3] Support streaming to an intermediate layer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alberto Garcia Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --eFiqhVoNrbUTDIDhjGgTMchapaTAgNNV7 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/20/2015 12:05 PM, Alberto Garcia wrote: > On Fri, Feb 20, 2015 at 10:34:58AM -0700, Eric Blake wrote: >=20 >>> I followed the proposed API from the wiki, which simply adds an >>> additional 'top' parameter to block-stream specifying the image >>> that data is written to: >> >> How does one learn whether qemu is new enough to support this >> mode? Until we add QMP introspection, learning whether an optional >> parameter exists requires attempting the command and seeing a >> different error depending on whether the argument is recognized. >=20 > Isn't it possible to just check the QEMU version number? Absolutely not. Vendors are very likely to backport this to earlier version numbers. Feature probes are ALWAYS a better idea than version probes. >=20 > If not, what's the recommended way to do it? Several design possibilities, but not all of them feasible at the moment.= 1. implement QAPI introspection (we've been dreaming about this since qemu 1.5 days), then the caller just queries to see if the version of QMP has the optional 'top' parameter. 2. implement the new feature as a new command (then the existing 'query-commands' becomes an easy probe; but we have code duplication with existing commands) (on the other hand, if we are going to frame 'stream' in terms of node operations instead of file name operations, this may be the best idea after all) 3. guarantee that we have sane error messages for bogus commands used as the probe. If {"execute":"block-stream", "data":{"device":"no-such","top":"bogus"}} gives a reliable DeviceNotFound error for qemu that supports optional 'top', and a reliable GenericError about an unknown argument 'top' in older qemu, then libvirt could use that as a poor-man's probe for the functionality existing. (ugly, and only works if you can guarantee a difference in error type between old and new qemu for a specific bogus command usage) Precedent: we do this sort of bogus command call on 'block-commit' to learn if qemu is new enough to support active commit, and the comments in the qemu code are explicit that a particular error message must not be changed because libvirt depends on it. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --eFiqhVoNrbUTDIDhjGgTMchapaTAgNNV7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJU57nhAAoJEKeha0olJ0NqfEwH/2wf3VwL3Y7+N8OMTulYDe6N VA5yMKIjDZxsFiygAajYgLJPIX7F28f/vZcmVS0X3muHN1t6tyi2m2tIKfg+zejL 2Mg1Djk4ISnr8wM85zSKPxhiZG2baQukNpJ0VkgGHWOoRcd6UPJTaufdtrFO4xDV BrKB6K/cbrOXMmWHAhRkGmJut3wKXrpaqFYnRsE5LCGzPTC0jqg50m0TxYmZKSea FV5B06Iz+KH8X+Z+TZQXOu2IGInaAAf56F/gj/j6kDS5Pit3mBa841vDQBrhIYPE V87gvP1XuRs9HoaaSGAv9lOXlXA91ziDklSGTi7BUanT/2gIWeB8vJnkBgIQl2M= =WOK4 -----END PGP SIGNATURE----- --eFiqhVoNrbUTDIDhjGgTMchapaTAgNNV7--