Skip to content
Snippets Groups Projects
Commit 74f69050 authored by Fam Zheng's avatar Fam Zheng Committed by Kevin Wolf
Browse files

iotests: Add iotests.image_size


This retrieves the virtual size of the image out of qemu-img info.

Signed-off-by: default avatarFam Zheng <famz@redhat.com>
Reviewed-by: default avatarMax Reitz <mreitz@redhat.com>
Reviewed-by: default avatarJeff Cody <jcody@redhat.com>
Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parent 4150ae60
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@
import qmp
import qtest
import struct
import json
# This will not work if arguments contain spaces but is necessary if we
......@@ -103,6 +104,11 @@ def create_image(name, size):
i = i + 512
file.close()
def image_size(img):
'''Return image's virtual size'''
r = qemu_img_pipe('info', '--output=json', '-f', imgfmt, img)
return json.loads(r)['virtual-size']
test_dir_re = re.compile(r"%s" % test_dir)
def filter_test_dir(msg):
return test_dir_re.sub("TEST_DIR", msg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment