Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

virtio_fs: wait a moment for the shared volume active #4246

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion provider/virtio_fs_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import logging
import os
import re
import time

from avocado.utils import process
from virttest import data_dir, error_context, utils_misc
Expand Down Expand Up @@ -67,7 +69,20 @@ def basic_io_test(test, params, session):
error_context.context(
"Creating file under %s inside guest." % fs_dest, LOG_JOB.info
)
session.cmd(cmd_dd % guest_file, io_timeout)
# for windows, after virtiofs service start up, should wait several seconds
# to make the volume active.
if windows:
end_time = time.time() + io_timeout
while time.time() < end_time:
output = session.cmd_output(cmd_dd % guest_file)
pattern = r"The system cannot find the file specified"
if not re.findall(pattern, output, re.M | re.I):
break
else:
test.log.info("Volume is not ready for io.")
time.sleep(2)
else:
session.cmd(cmd_dd % guest_file, io_timeout)

if windows:
guest_file_win = guest_file.replace("/", "\\")
Expand Down
16 changes: 15 additions & 1 deletion qemu/tests/virtio_fs_share_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,21 @@ def start_multifs_instance():
"Creating file under %s inside " "guest." % fs_dest,
test.log.info,
)
session.cmd(cmd_dd % guest_file, io_timeout)

# for windows, after virtiofs service start up, should wait
# for the volume active.
if os_type == "windows":
end_time = time.time() + io_timeout
while time.time() < end_time:
output = session.cmd_output(cmd_dd % guest_file)
pattern = r"The system cannot find the file specified"
if not re.findall(pattern, output, re.M | re.I):
break
else:
test.log.info("Volume is not ready for io.")
time.sleep(2)
else:
session.cmd(cmd_dd % guest_file, io_timeout)

if os_type == "linux":
cmd_md5_vm = cmd_md5 % guest_file
Expand Down
Loading