提交 7a8bd6c0 编写于 作者: N nanliu

virtio_serial: clean temporary file after data transfer

Should clean temporary file even data transfer failed
Signed-off-by: NNana Liu <nanliu@redhat.com>
上级 188b4660
......@@ -171,6 +171,7 @@ def transfer_data(params, vm, host_file_name=None, guest_file_name=None,
"""
session = vm.wait_for_login()
os_type = params["os_type"]
try:
guest_path = params.get("guest_script_folder", "C:\\")
guest_scripts = params.get("guest_scripts",
"VirtIoChannel_guest_send_receive.py")
......@@ -181,7 +182,7 @@ def transfer_data(params, vm, host_file_name=None, guest_file_name=None,
transfer_timeout = int(params.get("transfer_timeout", 720))
host_dir = data_dir.get_tmp_dir()
guest_dir = params.get("tmp_dir", '/var/tmp/')
host_file_size, guest_file_size, host_action, guest_action\
host_file_size, guest_file_size, host_action, guest_action \
= get_command_options(sender, file_size)
if not host_file_name:
host_file_name = generate_data_file(host_dir, host_file_size)
......@@ -202,6 +203,7 @@ def transfer_data(params, vm, host_file_name=None, guest_file_name=None,
port_name, guest_file_name, guest_action))
result = _transfer_data(
session, host_cmd, guest_cmd, transfer_timeout, sender)
finally:
if os_type == "windows":
guest_file_name = guest_file_name.replace("/", "\\")
if clean_file:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册