未验证 提交 def8e663 编写于 作者: L Longxiang Lyu 提交者: GitHub

Merge pull request #2162 from lolyu/rebase_support_block_device

commit_snapshot_to_raw_backing: add switch for size check 
......@@ -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.
先完成此消息的编辑!
想要评论请 注册