On Thu, Mar 17, 2022 at 07:49:29PM -0400, John Snow wrote: > Add a qemu_img_map() function by analogy with qemu_img_measure(), > qemu_img_check(), and qemu_img_info() that all return JSON information. > > Replace calls to qemu_img_pipe('map', '--output=json', ...) with this > new function, which provides better diagnostic information on failure. > > Note: The output for iotest 211 changes, because logging JSON after it > was deserialized by Python behaves a little differently than logging the > raw JSON document string itself. > (iotests.log() sorts the keys for Python 3.6 support.) > > Signed-off-by: John Snow <js...@redhat.com> > ---
> +++ b/tests/qemu-iotests/211.out > @@ -55,9 +53,7 @@ file format: IMGFMT > virtual size: 32 MiB (33554432 bytes) > cluster_size: 1048576 > > -[{ "start": 0, "length": 3072, "depth": 0, "present": true, "zero": false, > "data": true, "offset": 1024}, > -{ "start": 3072, "length": 33551360, "depth": 0, "present": true, "zero": > true, "data": true, "offset": 4096}] > - > +[{"data": true, "depth": 0, "length": 3072, "offset": 1024, "present": true, > "start": 0, "zero": false}, {"data": true, "depth": 0, "length": 33551360, > "offset": 4096, "present": true, "start": 3072, "zero": true}] The change in format can produce really long lines for a more complex map, which can introduce its own problems in legibility. But I can live with it. Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org