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

Merged
merged 1 commit into from
Feb 25, 2025
Merged
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
20 changes: 19 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
@@ -67,7 +69,23 @@ 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:
pattern = r"The system cannot find the file specified"
end_time = time.time() + io_timeout
while time.time() < end_time:
status, output = session.cmd_status_output(cmd_dd % guest_file)
if re.findall(pattern, output, re.M | re.I):
time.sleep(2)
continue
if status != 0:
test.fail("dd command failed on virtiofs.")
break
else:
test.error(f"Volume is not ready for io within {io_timeout}.")
else:
session.cmd(cmd_dd % guest_file, io_timeout)

if windows:
guest_file_win = guest_file.replace("/", "\\")
22 changes: 21 additions & 1 deletion qemu/tests/virtio_fs_share_data.py
Original file line number Diff line number Diff line change
@@ -447,7 +447,27 @@ 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":
pattern = r"The system cannot find the file specified"
end_time = time.time() + io_timeout
while time.time() < end_time:
status, output = session.cmd_status_output(
cmd_dd % guest_file
)
if re.findall(pattern, output, re.M | re.I):
time.sleep(2)
continue
if status != 0:
test.fail("dd command failed on virtiofs.")
break
else:
test.error(
f"Volume is not ready for io within {io_timeout}."
)
else:
session.cmd(cmd_dd % guest_file, io_timeout)

if os_type == "linux":
cmd_md5_vm = cmd_md5 % guest_file