From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkRox-00041H-GX for qemu-devel@nongnu.org; Thu, 06 Jun 2013 00:29:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkRow-00017e-BV for qemu-devel@nongnu.org; Thu, 06 Jun 2013 00:29:07 -0400 Received: from e23smtp04.au.ibm.com ([202.81.31.146]:56960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkRov-00016M-PK for qemu-devel@nongnu.org; Thu, 06 Jun 2013 00:29:06 -0400 Received: from /spool/local by e23smtp04.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 6 Jun 2013 14:15:17 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id D77FB2CE8053 for ; Thu, 6 Jun 2013 14:28:54 +1000 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r564EJpK3408188 for ; Thu, 6 Jun 2013 14:14:19 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r564Srox015163 for ; Thu, 6 Jun 2013 14:28:54 +1000 From: Wenchao Xia Date: Thu, 6 Jun 2013 12:27:56 +0800 Message-Id: <1370492881-12410-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH V15 0/5] enhancement for qmp/hmp interfaces of block info List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, armbru@redhat.com, lcapitulino@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, Wenchao Xia This series lets qmp interface show delaied info, including internal snapshot /backing chain on all block device at runtime, which helps management stack and human user, by retrieving exactly the same info of what qemu sees. Example: -> { "execute": "query-block" } <- { "return":[ { "io-status": "ok", "device":"ide0-hd0", "locked":false, "removable":false, "inserted":{ "ro":false, "drv":"qcow2", "encrypted":false, "file":"disks/test.qcow2", "backing_file_depth":1, "bps":1000000, "bps_rd":0, "bps_wr":0, "iops":1000000, "iops_rd":0, "iops_wr":0, "image":{ "filename":"disks/test.qcow2", "format":"qcow2", "virtual-size":2048000, "backing_file":"base.qcow2", "full-backing-filename":"disks/base.qcow2", "backing-filename-format:"qcow2", "snapshots":[ { "id": "1", "name": "snapshot1", "vm-state-size": 0, "date-sec": 10000200, "date-nsec": 12, "vm-clock-sec": 206, "vm-clock-nsec": 30 } ], "backing-image":{ "filename":"disks/base.qcow2", "format":"qcow2", "virtual-size":2048000 } } }, "type":"unknown" }, { "io-status": "ok", "device":"ide1-cd0", "locked":false, "removable":true, "type":"unknown" }, { "device":"floppy0", "locked":false, "removable":true, "type":"unknown" }, { "device":"sd0", "locked":false, "removable":true, "type":"unknown" } ] } These patches follows the rule that use qmp to retrieve information, hmp layer just does a translation from qmp object it got. To make code graceful, snapshot and image info retrieving code in qemu and qemu-img are merged into block layer, and some function names were adjusted to describe them better. For the part touched by the series, it works as: qemu qemu-img dump_monitor dump_stdout |--------------| | block/qapi.c This series requires following series applied: "[PATCH V3 0/4] qapi and snapshot code clean up in block layer", https://lists.gnu.org/archive/html/qemu-devel/2013-05/msg03539.html Special thanks for Markus, Stefan, Kevin, Eric reviewing many times. V15: Squash "add recursive member in ImageInfo" patch into 3/6. Address Stefan's comments: 5/5: use bool instead of int for variable "verbose". Wenchao Xia (5): 1 block: add snapshot info query function bdrv_query_snapshot_info_list() 2 block: add image info query function bdrv_query_image_info() 3 qmp: add ImageInfo in BlockDeviceInfo used by query-block 4 hmp: show ImageInfo in 'info block' 5 hmp: add parameters device and -v for info block block/qapi.c | 148 ++++++++++++++++++++++++++++++++++++++++++-------- hmp.c | 21 +++++++ include/block/qapi.h | 14 +++-- monitor.c | 7 ++- qapi-schema.json | 10 +++- qemu-img.c | 10 +++- qmp-commands.hx | 69 +++++++++++++++++++++++- 7 files changed, 242 insertions(+), 37 deletions(-)