提交 c875bf90 编写于 作者: P Ping Li

live_snapshot_chain: Flush data to disk before running system_reset

QMP command 'system_reset' is issued after creating files in the guest. The
command has an effect similar to the physical reset button on a PC. But
filesystems may be left in an unclean state which causes the loss of data. Run
the command "sync" to flush the data to disk.
Signed-off-by: NPing Li <pingl@redhat.com>
上级 6c2e32a8
......@@ -14,6 +14,11 @@
check_alive_cmd = "ls"
kill_vm = yes
remove_snapshot_images = yes
Windows:
x86_64:
sync_bin = WIN_UTILS:\Sync\sync64.exe /accepteula
i386, i686:
sync_bin = WIN_UTILS:\Sync\sync.exe /accepteula
variants:
- @default:
- with_data_plane:
......
......@@ -7,6 +7,7 @@ from virttest import error_context
from virttest import storage
from virttest import qemu_storage
from virttest import data_dir
from virttest import utils_misc
@error_context.context_aware
......@@ -90,10 +91,12 @@ def run(test, params, env):
file_dir = params.get("file_dir")
dir_create_cmd = params.get("dir_create_cmd")
md5_cmd = params.get("md5_cmd")
sync_cmd = params.get("sync_bin", "sync")
snapshot_chain = generate_snapshot_chain(snapshot_chain, snapshot_num)
snapshot_chain = re.split(r"\s+", snapshot_chain)
session = vm.wait_for_login(timeout=timeout)
sync_cmd = utils_misc.set_winutils_letter(session, sync_cmd)
md5_value = {}
files_in_guest = {}
......@@ -134,6 +137,10 @@ def run(test, params, env):
session.cmd(file_create_cmd % image)
md5 = session.cmd_output(md5_cmd % image)
md5_value[image] = {image: md5}
status, output = session.cmd_status_output(sync_cmd)
if status != 0:
test.error("Execute '%s' with failures('%s') " %
(sync_cmd, output))
if image_params.get("check_alive_cmd"):
session.cmd(image_params.get("check_alive_cmd"))
if image_params.get("file_create"):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册