Skip to content

Commit

Permalink
Merge pull request #4044 from iccaszhulili/virtiofs_openfiles
Browse files Browse the repository at this point in the history
Add the virtiofs element of openfiles
  • Loading branch information
chloerh authored Jan 16, 2025
2 parents df3c09f + 3984e7d commit fef8380
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions virttest/libvirt_xml/devices/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class Binary(base.base.LibvirtXMLBase):
<lock posix='on' flock='on'/>
<thread_pool size='16'/>
<sandbox mode="namespace"/>
<openfiles max='1234'/>
</binary>
"""

Expand All @@ -77,6 +78,7 @@ class Binary(base.base.LibvirtXMLBase):
"lock_posix",
"flock",
"thread_pool_size",
"open_files_max",
"sandbox_mode",
)

Expand All @@ -96,6 +98,13 @@ def __init__(self, virsh_instance=base.base.virsh):
accessors.XMLAttribute(
"flock", self, parent_xpath="/", tag_name="lock", attribute="flock"
)
accessors.XMLAttribute(
"open_files_max",
self,
parent_xpath="/",
tag_name="openfiles",
attribute="max",
)
accessors.XMLAttribute(
"thread_pool_size",
self,
Expand Down
3 changes: 3 additions & 0 deletions virttest/utils_test/libvirt_device_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ def create_fs_xml(fsdev_dict, launched_mode="auto"):
cache_mode = binary_dict.get("cache_mode", "none")
xattr = binary_dict.get("xattr", "on")
thread_pool_size = binary_dict.get("thread_pool_size")
open_files_max = binary_dict.get("open_files_max")
if cache_mode != "auto":
binary_xml.cache_mode = cache_mode
if xattr != "":
binary_xml.xattr = xattr
if thread_pool_size:
binary_xml.thread_pool_size = thread_pool_size
if open_files_max:
binary_xml.open_files_max = open_files_max
binary_xml.path = path
fs_dev.binary = binary_xml

Expand Down

0 comments on commit fef8380

Please sign in to comment.