Skip to content

enhancement for qmp/hmp interfaces of block info

Wenchao Xia qemu-devel 3 versions – Applied

Status from this message: Thanks, applied to my block tree:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v15 Latest5 patches 3 repliesApplied
  2. v146 patches 1 replySuperseded
  3. v136 patches 7 repliesSuperseded

Changes in v15 from the cover letter

Squash "add recursive member in ImageInfo" patch into 3/6. Address Stefan's comments:
5/5: use bool instead of int for variable "verbose".

Patches in v15 Applied

#Subject and filesSizeRepliesApplied
1/5block: add snapshot info query function bdrv_query_snapshot_info_list()block/qapi.c include/block/qapi.h qemu-img.c+49 -150 replies
2/5block: add image info query function bdrv_query_image_info()block/qapi.c include/block/qapi.h qemu-img.c+46 -140 replies
3/5qmp: add ImageInfo in BlockDeviceInfo used by query-blockblock/qapi.c include/block/qapi.h qapi-schema.json +1 more+125 -80 replies
4/5hmp: show ImageInfo in 'info block'hmp.c+14 -00 replies
5/5hmp: add parameters device and -v for info blockhmp.c monitor.c+20 -120 replies

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchEric Blake
1/5R-b
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v15 thread

Cover letter [Qemu-devel] [PATCH V15 0/5] enhancement for qmp/hmp interfaces of block info

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(-)