]> git.proxmox.com Git - mirror_qemu.git/commitdiff
iotests: Add more qemu_img helpers
authorNir Soffer <nirsof@gmail.com>
Mon, 27 Jul 2020 21:58:45 +0000 (00:58 +0300)
committerEric Blake <eblake@redhat.com>
Tue, 28 Jul 2020 14:54:43 +0000 (09:54 -0500)
Add 2 helpers for measuring and checking images:
- qemu_img_measure()
- qemu_img_check()

Both use --output-json and parse the returned json to make easy to use
in other tests. I'm going to use them in a new test, and I hope they
will be useful in may other tests.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Message-Id: <20200727215846.395443-4-nsoffer@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
tests/qemu-iotests/iotests.py

index 8f79668435a04fd766833247d95eacece92aaea3..717b5b652c4535252a2903f02945488dac7551df 100644 (file)
@@ -141,6 +141,12 @@ def qemu_img_create(*args):
 
     return qemu_img(*args)
 
+def qemu_img_measure(*args):
+    return json.loads(qemu_img_pipe("measure", "--output", "json", *args))
+
+def qemu_img_check(*args):
+    return json.loads(qemu_img_pipe("check", "--output", "json", *args))
+
 def qemu_img_verbose(*args):
     '''Run qemu-img without suppressing its output and return the exit code'''
     exitcode = subprocess.call(qemu_img_args + list(args))