From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqRbo-0003QV-6j for qemu-devel@nongnu.org; Tue, 10 Dec 2013 13:00:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqRbj-0002Z1-5a for qemu-devel@nongnu.org; Tue, 10 Dec 2013 13:00:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21118) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqRbi-0002Yr-TM for qemu-devel@nongnu.org; Tue, 10 Dec 2013 13:00:31 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBAI0QmE024703 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 10 Dec 2013 13:00:30 -0500 Message-ID: <52A756AF.7000309@redhat.com> Date: Tue, 10 Dec 2013 11:00:15 -0700 From: Eric Blake MIME-Version: 1.0 References: <1386694828-19786-1-git-send-email-pbonzini@redhat.com> <1386694828-19786-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1386694828-19786-5-git-send-email-pbonzini@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9EgCVbrbsvBXcREwCF4faP8xG1S9FX0bp" Subject: Re: [Qemu-devel] [PATCH 4/5] monitor: add object-add (QMP) and object_add (HMP) command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: imammedo@redhat.com, akong@redhat.com, armbru@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --9EgCVbrbsvBXcREwCF4faP8xG1S9FX0bp Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/10/2013 10:00 AM, Paolo Bonzini wrote: > Add two commands that are the monitor counterparts of -object. The com= mands > have the same Visitor-based implementation, but use different kinds of > visitors so that the HMP command has a DWIM string-based syntax, while > the QMP variant accepts a stricter JSON-based properties dictionary. >=20 > Signed-off-by: Paolo Bonzini > --- > +++ b/qapi-schema.json > @@ -2759,6 +2759,26 @@ > { 'command': 'netdev_del', 'data': {'id': 'str'} } > =20 > ## > +# @object_add: I'd prefer object-add for the QMP name (particularly since that's what you called it in your commit message). > +# > +# Create a QOM object. > +# > +# @qom-type: the class name for the object to be created > +# > +# @id: the name of the new object > +# > +# @props: #optional a list of properties to be passed to the backend s/list/dictionary/ > +# > +# Returns: Nothing on success > +# Error if @qom-type is not a valid class name > +# > +# Since: 2.0 > +## > +{ 'command': 'object_add', Again, object-add > + 'data': {'qom-type': 'str', 'id': 'str', '*props': 'dict'}, > + 'gen': 'no' } This feels VERY open-coded. No where else in qapi-schema do we have 'dict' as a type; using it violates all sorts of type-safety (which, I guess, is the point), making it impossible to introspect what keys are valid for use in the "props":{...} dictionary. Do we really want to play this fast and loose with the type system, or should we try harder to make this a robust self-describing union of types? That is, why can't we have object-add use a discriminated union, where qom-type is the discriminator, and where props is an appropriate JSON struct type that corresponds to the branch of the union, so that we get full introspection on the set of valid keys to put in props for any given qom-type? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --9EgCVbrbsvBXcREwCF4faP8xG1S9FX0bp 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.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSp1avAAoJEKeha0olJ0NqmkwH+gLOfSrfteGczTYcyzCi+usY nG2MJJnIYwb2jyh1MDQyEBWNnGNQrskxLBnT/mav9EavxmKn66TkiIJfFvWMl/Pi UYUq0QTCrjZ9nEXjbG8VG2ijiP2Fw97R5U72Ha3VJqP/zMrgyj5K4c3BHbl0Ynmw 8CURkFyc2CZnjPQYShNstf0ADqeuK2onihp+rGa3Hafs947cAGeBngDGP4pbRhTj Ju+K8lOOksoiFM0MCwh3BtZxL2qYbuKqx4deEzaLI1/5M2XySbEsB2TK5hfOn4Ru 3Hncd3+aexTL9knHH+zAegQ0qBT3IY+Jzos0fjReqJRqJmAv0qdMFephECwCous= =MPh3 -----END PGP SIGNATURE----- --9EgCVbrbsvBXcREwCF4faP8xG1S9FX0bp--