From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbtWc-0007cP-16 for qemu-devel@nongnu.org; Mon, 13 May 2013 10:14:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UbtWa-0002Wy-Gb for qemu-devel@nongnu.org; Mon, 13 May 2013 10:14:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22947) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UbtWa-0002Wn-8s for qemu-devel@nongnu.org; Mon, 13 May 2013 10:14:48 -0400 Message-ID: <5190F534.40806@redhat.com> Date: Mon, 13 May 2013 08:14:12 -0600 From: Eric Blake MIME-Version: 1.0 References: <1367221335-22777-1-git-send-email-stefanha@redhat.com> <1367221335-22777-3-git-send-email-stefanha@redhat.com> <518DC2C6.5030500@redhat.com> <20130513082811.GB6419@dhcp-200-207.str.redhat.com> <5190E30E.40005@redhat.com> <20130513130931.GC6419@dhcp-200-207.str.redhat.com> <20130513091858.54c4e4e6@redhat.com> In-Reply-To: <20130513091858.54c4e4e6@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2LKHSQJVRRBQNEGIGLVQB" Subject: Re: [Qemu-devel] [PATCH v2 2/3] block: add block-backup QMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: Kevin Wolf , Fam Zheng , qemu-devel@nongnu.org, Wenchao Xia , imain@redhat.com, Stefan Hajnoczi , pbonzini@redhat.com, dietmar@proxmox.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2LKHSQJVRRBQNEGIGLVQB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 05/13/2013 07:18 AM, Luiz Capitulino wrote: >>>> Luiz, any idea how to do something like this, a QAPI enum with value= s >>>> that are determined at runtime? Especially with respect to the comin= g >>>> schema introspection? >>> >>> Or maybe we make the 'enum' list ALL possible types, but then add a >>> query-* command that returns an array of only those enum values that = are >>> supported. Introspection would see all types, but the query command >>> would be the useful variant that is runtime-dependent. >=20 > Agreed. This is a capability, and we're adding query- commands to query= > capabilities. >=20 >> Then is there any advantage in making it an enum in the first place? >=20 > Eric is in a better position to answer this, but the fact that this can= > be queried isn't a strong pro for having it? Hmm, you raise an interesting point - if we have a query-block-formats command that returns an array of strings, then keep 'str' everywhere else a format is required, that is no different for what is sent over the wire compared to a query-block-formats that returns an array of 'BlockFormat' enum values, with the enum showing all possible formats (even if support wasn't compiled in), and with 'BlockFormat' everywhere else. Introspection-wise, you'd have to know that you call query-block-formats instead of introspecting on the type of the format argument, but information-wise, there's no loss of details if the query- command provides the runtime list, and the remaining commands stick with 'str'. I still think an enum is a bit nicer from the type-safety aspect, but I'm finding it hard to envision any scenario where libvirt would have to resort to introspection if we have a query-block-formats in place, and thus am not opposed to your idea of avoiding the enum. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2LKHSQJVRRBQNEGIGLVQB 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.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRkPU0AAoJEKeha0olJ0NqebYIAIyaa2/hBdt2w6khASQzVxTi sFyZvwvymZbuMSQtbg4yY+w3IaDu+UHtiIIpx6J48/cMoHGT8t4PjBYNja8LoQho 6apEw08p/hmKrhhUbNnLPQvArjmeiP/mH9hy38litXkzM2QhNqSdd/2+zz2gkruU WB4nAsJjndLCSy3TNnulSE2k2Wq+IaoeSysXf3Uk1dG+y/yABQi0BE5rVS3xf8Pa MBex5k5TRhOOWnvveWjuDheqQBN4AJVVh75fyzVpzmP8eIQ3JzTBZQIkZgPjyBJX H0E/zsLmZkUSMTmYfJcLkjmCm45J2iHPAd3esgra+uW6VIrmDwrlq9fN8gVHqi0= =0+x+ -----END PGP SIGNATURE----- ------enig2LKHSQJVRRBQNEGIGLVQB--