提交 74f69050 编写于 作者: F Fam Zheng 提交者: Kevin Wolf

iotests: Add iotests.image_size

This retrieves the virtual size of the image out of qemu-img info.
Signed-off-by: NFam Zheng <famz@redhat.com>
Reviewed-by: NMax Reitz <mreitz@redhat.com>
Reviewed-by: NJeff Cody <jcody@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 4150ae60
......@@ -28,6 +28,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'scripts', '
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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册