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

Add the cases of virtiofs openfiles #6095

Merged
merged 1 commit into from
Jan 16, 2025
Merged
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
1 change: 1 addition & 0 deletions libvirt/tests/cfg/virtual_device/filesystem_device.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
variants:
- thread_pool_16:
thread_pool_size = 16
openfiles = "yes"
only positive_test..nop..xattr_on.cache_mode_auto, positive_test..detach_device..xattr_on.cache_mode_auto
- thread_pool_noset:
variants:
Expand Down
16 changes: 14 additions & 2 deletions libvirt/tests/src/virtual_device/filesystem_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def generate_expected_process_option():
# virtiofsd man pages. Add another kind of pattern here to avoid
# possible change in the future again.
expected_results += " --thread-pool-size(\s|=)%s" % thread_pool_size
if openfiles:
expected_results += " --rlimit-nofile(\s|=)%s" % open_files_max
logging.debug(expected_results)
return expected_results

Expand Down Expand Up @@ -226,6 +228,7 @@ def check_filesystem_hotplug_with_mem_setup():
xattr = params.get("xattr", "on")
path = params.get("virtiofsd_path", "/usr/libexec/virtiofsd")
thread_pool_size = params.get("thread_pool_size")
openfiles = params.get("openfiles", "no") == "yes"
queue_size = int(params.get("queue_size", "512"))
driver_type = params.get("driver_type", "virtiofs")
guest_num = int(params.get("guest_num", "1"))
Expand Down Expand Up @@ -279,6 +282,13 @@ def check_filesystem_hotplug_with_mem_setup():
libvirt_version.is_libvirt_feature_supported(params)
check_filesystem_hotplug_with_mem_setup()
return

if openfiles:
with open('/proc/sys/fs/nr_open', 'r') as file:
open_files_max = file.read().strip()
else:
open_files_max = None

# Define filesystem device xml
for index in range(fs_num):
driver = {'type': driver_type, 'queue': queue_size}
Expand All @@ -289,8 +299,10 @@ def check_filesystem_hotplug_with_mem_setup():
source = {'socket': source_socket}
target = {'dir': target_dir}
if launched_mode == "auto":
binary_keys = ['path', 'cache_mode', 'xattr', 'thread_pool_size']
binary_values = [path, cache_mode, xattr, thread_pool_size]
binary_keys = ['path', 'cache_mode', 'xattr',
'thread_pool_size', "open_files_max"]
binary_values = [path, cache_mode, xattr,
thread_pool_size, open_files_max]
binary_dict = dict(zip(binary_keys, binary_values))
source = {'dir': source_dir}
accessmode = "passthrough"
Expand Down