From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UF6dT-0003Bu-My for qemu-devel@nongnu.org; Mon, 11 Mar 2013 13:35:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UF6dR-0005vK-0l for qemu-devel@nongnu.org; Mon, 11 Mar 2013 13:35:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UF6dQ-0005vE-Om for qemu-devel@nongnu.org; Mon, 11 Mar 2013 13:35:40 -0400 Message-ID: <513E15EA.6040800@redhat.com> Date: Mon, 11 Mar 2013 11:35:38 -0600 From: Eric Blake MIME-Version: 1.0 References: <1362867748-30528-1-git-send-email-stefanha@redhat.com> <1362867748-30528-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1362867748-30528-2-git-send-email-stefanha@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2FRBSTLGVWAKLEGTMFPOH" Subject: Re: [Qemu-devel] [RFC 1/8] block: add virtual_size to query-block QMP output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Markus Armbruster , qemu-devel@nongnu.org, dietmar@proxmox.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2FRBSTLGVWAKLEGTMFPOH Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/09/2013 03:22 PM, Stefan Hajnoczi wrote: > There is currently no way to query the size of a drive. Add a > 'virtual_size' field to the 'query-block' QMP output. >=20 > Signed-off-by: Stefan Hajnoczi > --- > block.c | 1 + > qapi-schema.json | 5 ++++- > 2 files changed, 5 insertions(+), 1 deletion(-) >=20 > diff --git a/block.c b/block.c > index 124a9eb..0128e27 100644 > --- a/block.c > +++ b/block.c > @@ -2908,6 +2908,7 @@ BlockInfo *bdrv_query_info(BlockDriverState *bs) > info->has_inserted =3D true; > info->inserted =3D g_malloc0(sizeof(*info->inserted)); > info->inserted->file =3D g_strdup(bs->filename); > + info->inserted->virtual_size =3D bdrv_getlength(bs); > info->inserted->ro =3D bs->read_only; > info->inserted->drv =3D g_strdup(bs->drv->format_name); > info->inserted->encrypted =3D bs->encrypted; > diff --git a/qapi-schema.json b/qapi-schema.json > index 28b070f..6b64aec 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -751,6 +751,8 @@ > # > # @iops_wr: write I/O operations per second is specified > # > +# @virtual_size: size of block device, in bytes It is traditional to list 'since 1.5' when adding a field that did not appear in earlier qemu releases. > +# > # Since: 0.14.0 > # > # Notes: This interface is only found in @BlockInfo. > @@ -760,7 +762,8 @@ > '*backing_file': 'str', 'backing_file_depth': 'int', > 'encrypted': 'bool', 'encryption_key_missing': 'bool', > 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int', > - 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int'} } > + 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int', > + 'virtual_size': 'int' } } I was about to suggest 'virtual-size' instead of 'virtual_size', since we prefer '-' over '_' in QMP; but since this command has pre-existing uses of '_', keeping consistency within the struct trumps consistency with the rest of QMP. The idea makes sense, and my only complaint was a trivial documentation matter; so feel free to add this when re-posting without the RFC: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2FRBSTLGVWAKLEGTMFPOH 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/ iQEcBAEBCAAGBQJRPhXqAAoJEKeha0olJ0NqRCAH/R7eo3LSXKndY13NIPaS9Mkr xXM4ppFxRodjZ+MHVNzAc8JFSMbH5x49OttOi/sJOz4ry/w/F1N5ckB0iRJVteNA NKd6m6YR7k6CZYQ9JGx8xRrOyw8ZKMP6T3k4o4CJ6r6aygiCVDDin/9M8rxrZTzy C31JB8uVnhrbto9VKk7KxQOtgOIiKi+yV8XN40Y+cUWj8udoPgHoo5/YJGsAI7Bh QtaPPcV1qjNYkp9QY6pccr4EX3pcBnJA1tDS5bTjiXs4BnSHF9aam2afBZgLdf4j 3KH4LmDlSGGo5idrAaV+0gtcsCj+RHfQLrUPa+LlmM5XLYITtdSwxl9JrTx+nA0= =l1fF -----END PGP SIGNATURE----- ------enig2FRBSTLGVWAKLEGTMFPOH--