From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54741) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBslP-0004x1-KX for qemu-devel@nongnu.org; Mon, 28 Jul 2014 17:47:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XBslK-0004Cp-LV for qemu-devel@nongnu.org; Mon, 28 Jul 2014 17:47:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38513) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XBslK-0004Ck-Di for qemu-devel@nongnu.org; Mon, 28 Jul 2014 17:47:18 -0400 Message-ID: <53D6C4E3.1010701@redhat.com> Date: Mon, 28 Jul 2014 15:47:15 -0600 From: Eric Blake MIME-Version: 1.0 References: <1406302776-2306-1-git-send-email-sanidhya.iiith@gmail.com> <1406302776-2306-4-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1406302776-2306-4-git-send-email-sanidhya.iiith@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xnQRrcqGU6wF8oNd1XCaVdTJxKDkrClwD" Subject: Re: [Qemu-devel] [PATCH RFC v2 03/12] VMState test: query command to extract the qdevified device names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sanidhya Kashyap , qemu list Cc: "Dr. David Alan Gilbert" , Juan Quintela This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xnQRrcqGU6wF8oNd1XCaVdTJxKDkrClwD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/25/2014 09:39 AM, Sanidhya Kashyap wrote: > I have provided a qmp interface for getting the list of qdevified devic= es > that have been registered with SaveVMHandlers. >=20 > Signed-off-by: Sanidhya Kashyap > --- > qapi-schema.json | 22 ++++++++++++++++++++++ > qmp-commands.hx | 25 +++++++++++++++++++++++++ > savevm.c | 34 ++++++++++++++++++++++++++++++++++ > 3 files changed, 81 insertions(+) >=20 > +# @device: list of qdevified device names > +# > +# Since 2.2 > +## > +{ 'type': 'VMStatesQdevDevices', > + 'data': { 'device': ['str'] } } Here, you name it 'device' [1] > + > +## > +# @query-qdev-devices > +# > +# returns the VMStatesQdevDevices that have the associated value > +# > +# Since 2.2 > +## > +{ 'command': 'query-qdev-devices', > + 'returns': 'VMStatesQdevDevices' } and state that it returns a single struct [2] > diff --git a/qmp-commands.hx b/qmp-commands.hx > index 4be4765..2e20032 100644 > --- a/qmp-commands.hx > +++ b/qmp-commands.hx > @@ -3755,3 +3755,28 @@ Example: > <- { "return": {} } > =20 > EQMP > + > + { > + .name =3D "query-qdev-devices", > + .args_type =3D "", > + .mhandler.cmd_new =3D qmp_marshal_input_query_qdev_devices, > + }, > + > +SQMP > +query-qdev-devices > +------------------ > + > +Shows registered Qdevified devices > + > + > +Example (1): > + > +-> { "execute": "query-qdev-devices" } > +<- { "return": [ But here, your example shows it returning an array of structs [2] > + { > + "devices": [ "kvm-tpr-opt", "piix4_pm" ] where each struct contains a member named 'devices' [1] that is also an array. I actually think the most extensible thing would be to return something more like this QMP wire contents: { "return": [ { "device": "kvm-tpr-opt" }, { "device": "piix4_pm" } ] } which would match this .json content: { 'type': 'VMStatesQdevDevices', 'data': { 'device': 'str' } } { 'command': 'query-qdev-devices', 'returns': [ 'VMStatesQdevDevices' ] } and also be the most extensible for future tweaks, such as adding an optional boolean flag to the json to tell us more about certain devices: { 'type': 'VMStatesQdevDevices', 'data': { 'device': 'str', '*foo': 'bool' } } and lead to this QMP wire transaction: { "return": [ { "device": "kvm-tpr-opt" }, { "device": "piix4_pm", 'foo': true } ] } At any rate, you MUST make your example match your documentation. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xnQRrcqGU6wF8oNd1XCaVdTJxKDkrClwD 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 iQEcBAEBCAAGBQJT1sTkAAoJEKeha0olJ0NqvH4IAJb1OO07bdMqPWf+njnuqayu MusqOz3QIHRUVlfTLkVo5OtdR7GzAJBsPCCbhkcbGW0ryBl4I8+ITtUVFs0jzwop TRQjdLt5npWRDMUX1fC5n4KA9EVmvFYFguL4ZZmvpRMAAJQL13iuMZ0wp80J2e85 3PfMo6XmOcbC/WUg1Ramim9/PNvxGDdSHOeQSpi2Jnh8IAwkHg2iU7F90QQ65UCi wo95j6NtaSTcv38I5Ye4vGIEXdIsloCgKicj8PrAT29bgKB/pkC9OrDEyBjPL9wl kagw88TbxD4MWxG/+wnmizO3R7hOrjQZK+qpOBihahP13E+N864k3eKMyZbUmb0= =lsCQ -----END PGP SIGNATURE----- --xnQRrcqGU6wF8oNd1XCaVdTJxKDkrClwD--