提交 643c66d2 编写于 作者: L lolyu

commit_snapshot_to_raw_backing: add switch for size check

if image is a block device, the size check will fail the case because
QEMU fails to get correct size info from block device. So add a switch
to enable tester to turn off the snapshot size check.
Signed-off-by: Nlolyu <lolyu@redhat.com>
上级 49f55a02
......@@ -21,6 +21,7 @@
dd_total_size = "${dd_bs_val} * ${dd_bs_count} * 1024 ** 2"
file_create_cmd = "dd if=/dev/urandom of=%s bs=${dd_bs_val}M count=${dd_bs_count}"
guest_file_name = ${tmp_file_name}
snapshot_size_check_after_commit = yes
Windows:
guest_file_name = C:\testfile
x86_64:
......
......@@ -82,18 +82,22 @@ def run(test, params, env):
else:
logging.info("Commit snapshot image %s back to %s.", snapshot, base)
org_size = json.loads(sn_img.info(output="json"))["actual-size"]
size_check = params.get("snapshot_size_check_after_commit") == "yes"
if size_check:
org_size = json.loads(sn_img.info(output="json"))["actual-size"]
sn_img.commit(cache_mode=cache_mode)
remain_size = json.loads(sn_img.info(output="json"))["actual-size"]
"""Verify the snapshot file whether emptied after committing"""
logging.info("Verify the snapshot file whether emptied after committing")
commit_size = org_size - remain_size
dd_size = eval(params["dd_total_size"])
if commit_size >= dd_size:
logging.info("The snapshot file was emptied!")
else:
test.fail("The snapshot file was not emptied, check pls!")
if size_check:
remain_size = json.loads(sn_img.info(output="json"))["actual-size"]
# Verify the snapshot file whether emptied after committing
logging.info("Verify the snapshot file whether emptied after committing")
commit_size = org_size - remain_size
dd_size = eval(params["dd_total_size"])
if commit_size >= dd_size:
logging.info("The snapshot file was emptied!")
else:
test.fail("The snapshot file was not emptied, check pls!")
base_qit = QemuImgTest(test, params, env, base)
base_qit.start_vm()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册