From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UESAy-00059I-RS for qemu-devel@nongnu.org; Sat, 09 Mar 2013 17:23:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UESAv-0008PC-Rq for qemu-devel@nongnu.org; Sat, 09 Mar 2013 17:23:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UESAv-0008P3-KR for qemu-devel@nongnu.org; Sat, 09 Mar 2013 17:23:33 -0500 From: Stefan Hajnoczi Date: Sat, 9 Mar 2013 23:22:21 +0100 Message-Id: <1362867748-30528-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1362867748-30528-1-git-send-email-stefanha@redhat.com> References: <1362867748-30528-1-git-send-email-stefanha@redhat.com> Subject: [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: qemu-devel@nongnu.org Cc: Kevin Wolf , dietmar@proxmox.com, Stefan Hajnoczi , Markus Armbruster There is currently no way to query the size of a drive. Add a 'virtual_size' field to the 'query-block' QMP output. Signed-off-by: Stefan Hajnoczi --- block.c | 1 + qapi-schema.json | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) 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 = true; info->inserted = g_malloc0(sizeof(*info->inserted)); info->inserted->file = g_strdup(bs->filename); + info->inserted->virtual_size = bdrv_getlength(bs); info->inserted->ro = bs->read_only; info->inserted->drv = g_strdup(bs->drv->format_name); info->inserted->encrypted = 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 +# # 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' } } ## # @BlockDeviceIoStatus: -- 1.8.1.4