From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bGXsu-0006zl-61 for qemu-devel@nongnu.org; Fri, 24 Jun 2016 16:39:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bGXsr-0003Oq-WE for qemu-devel@nongnu.org; Fri, 24 Jun 2016 16:39:27 -0400 References: <1466692592-9551-1-git-send-email-kwolf@redhat.com> <1466692592-9551-6-git-send-email-kwolf@redhat.com> From: Eric Blake Message-ID: <576D9A76.1090803@redhat.com> Date: Fri, 24 Jun 2016 14:39:18 -0600 MIME-Version: 1.0 In-Reply-To: <1466692592-9551-6-git-send-email-kwolf@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="POJuQL3XQiCIqIJB59TCJkppxwDmHGkb0" Subject: Re: [Qemu-devel] [RFC PATCH 5/7] block: Accept device model name for blockdev-open/close-tray List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: armbru@redhat.com, stefanha@redhat.com, mreitz@redhat.com, famz@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --POJuQL3XQiCIqIJB59TCJkppxwDmHGkb0 From: Eric Blake To: Kevin Wolf , qemu-block@nongnu.org Cc: armbru@redhat.com, stefanha@redhat.com, mreitz@redhat.com, famz@redhat.com, qemu-devel@nongnu.org Message-ID: <576D9A76.1090803@redhat.com> Subject: Re: [RFC PATCH 5/7] block: Accept device model name for blockdev-open/close-tray References: <1466692592-9551-1-git-send-email-kwolf@redhat.com> <1466692592-9551-6-git-send-email-kwolf@redhat.com> In-Reply-To: <1466692592-9551-6-git-send-email-kwolf@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/23/2016 08:36 AM, Kevin Wolf wrote: > This is an example conversion of a QMP command that operates on the > BlockBackend level to accept both the device model name (which is > supposed to become the primary interface) and the BlockBackend name. >=20 > Naming suggestions for the new QMP field are welcome. The obvious one > would be "device", but that's already taken... >=20 > We'll also want QAPI to understand that exactly one of the two fields > must be given, so we can remove/don't have to add explicit code in the > command implementations to check that. >=20 > Signed-off-by: Kevin Wolf > --- > blockdev.c | 60 +++++++++++++++++++++++++++++++++++++++-----= -------- > qapi/block-core.json | 14 ++++++++---- > qmp-commands.hx | 12 +++++++---- > 3 files changed, 63 insertions(+), 23 deletions(-) >=20 > +++ b/qapi/block-core.json > @@ -2201,7 +2201,9 @@ > # to it > # - if the guest device does not have an actual tray > # > -# @device: block device name > +# @device: block device name (deprecated, use @id instead) > +# > +# @id: the name or QOM path of the guest device > # Is this something we want to rush into 2.7, or is it big enough to convert all the commands that we may want to wait for 2.8? Either way, we'll probably want to add a '(since 2.x)' hint, and maybe come up with a standard way to document mutually-exclusive members given that Marc-Andre is trying to automate documentation from the .json file. > # @force: #optional if false (the default), an eject request will be = sent to > # the guest if it has locked the tray (and the tray will not = be opened > @@ -2211,7 +2213,8 @@ > # Since: 2.5 > ## > { 'command': 'blockdev-open-tray', > - 'data': { 'device': 'str', > + 'data': { '*device': 'str', > + '*id': 'str', > '*force': 'bool' } } > =20 Your idea about having some particular QAPI shorthand for marking two mutually-exclusive members may indeed be worth addressing, since we're going to have more cases of it. But off-hand, I don't know what syntax would be best, particularly if we want to keep QAPI close to JSON. > +++ b/qmp-commands.hx > @@ -4255,7 +4255,7 @@ EQMP > =20 > { > .name =3D "blockdev-open-tray", > - .args_type =3D "device:s,force:b?", > + .args_type =3D "device:s?,id:s?,force:b?", > .mhandler.cmd_new =3D qmp_marshal_blockdev_open_tray, On the bright side, once Marc-Andre's work goes in, we won't have qmp-commands.hx to worry about. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --POJuQL3XQiCIqIJB59TCJkppxwDmHGkb0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXbZp2AAoJEKeha0olJ0NqTgMIAJbi6q+k/adjnQu+UJtGj6j8 x3WQyKPt8VOsC5Yal2Py6LZJn0h5XCf6ZvFYUyoWGrw8vQyauCw6SqL4xZUcNxT4 9Mo1r4fF3AgAAC/H2P8Fgaak1+9wtk4SUFGPD9PloRL6rScZhG2qUyDphqm9YzMf xUCAA2wC5N/Bo90CVZnKvLV0yO71xrhSst9nPMlDi6fpGfDmYwf+3i2Hu0hHS1G5 9GksDNeYFTc0+pGr5JMzzhiwka6g2bAmp8AmmMdA4OgfmOXrLaSqVIpGwBbGGD0x 77s4QdVZ4QDcNJgTtRaDdi6MYIDtu3BE0pTRFbqe9OBUMDYWR8eqIoLJF5EnVDk= =K1/4 -----END PGP SIGNATURE----- --POJuQL3XQiCIqIJB59TCJkppxwDmHGkb0--