未验证 提交 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 @@ ...@@ -21,6 +21,7 @@
dd_total_size = "${dd_bs_val} * ${dd_bs_count} * 1024 ** 2" 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}" file_create_cmd = "dd if=/dev/urandom of=%s bs=${dd_bs_val}M count=${dd_bs_count}"
guest_file_name = ${tmp_file_name} guest_file_name = ${tmp_file_name}
snapshot_size_check_after_commit = yes
Windows: Windows:
guest_file_name = C:\testfile guest_file_name = C:\testfile
x86_64: x86_64:
......
...@@ -82,11 +82,15 @@ def run(test, params, env): ...@@ -82,11 +82,15 @@ def run(test, params, env):
else: else:
logging.info("Commit snapshot image %s back to %s.", snapshot, base) logging.info("Commit snapshot image %s back to %s.", snapshot, base)
size_check = params.get("snapshot_size_check_after_commit") == "yes"
if size_check:
org_size = json.loads(sn_img.info(output="json"))["actual-size"] org_size = json.loads(sn_img.info(output="json"))["actual-size"]
sn_img.commit(cache_mode=cache_mode) sn_img.commit(cache_mode=cache_mode)
if size_check:
remain_size = json.loads(sn_img.info(output="json"))["actual-size"] remain_size = json.loads(sn_img.info(output="json"))["actual-size"]
"""Verify the snapshot file whether emptied after committing""" # Verify the snapshot file whether emptied after committing
logging.info("Verify the snapshot file whether emptied after committing") logging.info("Verify the snapshot file whether emptied after committing")
commit_size = org_size - remain_size commit_size = org_size - remain_size
dd_size = eval(params["dd_total_size"]) dd_size = eval(params["dd_total_size"])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册