On 09.03.22 04:53, 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.

Signed-off-by: John Snow <js...@redhat.com>
---
  tests/qemu-iotests/041                         |  5 ++---
  tests/qemu-iotests/211                         |  6 +++---
  tests/qemu-iotests/iotests.py                  |  3 +++
  tests/qemu-iotests/tests/block-status-cache    | 11 ++++-------
  tests/qemu-iotests/tests/parallels-read-bitmap |  6 ++----
  5 files changed, 14 insertions(+), 17 deletions(-)

[...]

diff --git a/tests/qemu-iotests/211 b/tests/qemu-iotests/211
index f52cadade1..1a3b4596c8 100755
--- a/tests/qemu-iotests/211
+++ b/tests/qemu-iotests/211
@@ -59,7 +59,7 @@ with iotests.FilePath('t.vdi') as disk_path, \
      vm.shutdown()
iotests.img_info_log(disk_path)
-    iotests.log(iotests.qemu_img_pipe('map', '--output=json', disk_path))
+    iotests.log(iotests.qemu_img_map(disk_path))
#
      # Successful image creation (explicit defaults)
@@ -83,7 +83,7 @@ with iotests.FilePath('t.vdi') as disk_path, \
      vm.shutdown()
iotests.img_info_log(disk_path)
-    iotests.log(iotests.qemu_img_pipe('map', '--output=json', disk_path))
+    iotests.log(iotests.qemu_img_map(disk_path))
#
      # Successful image creation (with non-default options)
@@ -107,7 +107,7 @@ with iotests.FilePath('t.vdi') as disk_path, \
      vm.shutdown()
iotests.img_info_log(disk_path)
-    iotests.log(iotests.qemu_img_pipe('map', '--output=json', disk_path))
+    iotests.log(iotests.qemu_img_map(disk_path))
#
      # Invalid BlockdevRef

This breaks 211, because originally, the output wasn’t piped through Python’s json module, i.e. the original json data was printed as it’s generated by qemu.  Now it’s parsed by the json module, and the Python object is logged, so the output changes.

Still sounds good to me, but this part will require fixing up the reference output.

Hanna


Reply via email to