Skip to content

Commit

Permalink
Merge pull request autotest#5802 from iccaszhulili/lock
Browse files Browse the repository at this point in the history
Update the lock options and virtiofsd options format
  • Loading branch information
chunfuwen authored Jul 24, 2024
2 parents c283222 + a9e94bf commit 9ea3a9b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 43 deletions.
32 changes: 10 additions & 22 deletions libvirt/tests/cfg/virtual_device/filesystem_device.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
take_regular_screendumps = "no"
vms = "avocado-vt-vm1"
start_vm = no
cache_mode = "none"
lock_posix = "off"
flock = "off"
cache_mode = "auto"
virtiofsd_path = "/usr/libexec/virtiofsd"
queue_size = "512"
driver_type = "virtiofs"
Expand All @@ -32,17 +30,17 @@
- two_guests:
vms = "avocado-vt-vm1 avocado-vt-vm2"
guest_num = 2
only nop.fs_test.xattr_on.flock_off.lock_posix_off.cache_mode_none..one_fs, hotplug_unplug..fs_test.xattr_on.flock_off.lock_posix_off.cache_mode_none..one_fs
only nop.fs_test.xattr_on.cache_mode_auto..one_fs, hotplug_unplug..fs_test.xattr_on.cache_mode_auto..one_fs
variants:
- one_fs:
fs_num = 1
- multiple_fs:
fs_num = 2
only xattr_on.flock_off.lock_posix_off.cache_mode_none
only xattr_on.cache_mode_auto
variants:
- thread_pool_16:
thread_pool_size = 16
only positive_test..nop..xattr_on.flock_off.lock_posix_off.cache_mode_none, positive_test..detach_device..xattr_on.flock_off.lock_posix_off.cache_mode_none
only positive_test..nop..xattr_on.cache_mode_auto, positive_test..detach_device..xattr_on.cache_mode_auto
- thread_pool_noset:
variants:
- cache_mode_none:
Expand All @@ -51,16 +49,6 @@
cache_mode = "always"
- cache_mode_auto:
cache_mode = "auto"
variants:
- lock_posix_off:
lock_posix = "off"
- lock_posix_on:
lock_posix = "on"
variants:
- flock_on:
flock = "on"
- flock_off:
flock = "off"
variants:
- xattr_on:
xattr = "on"
Expand All @@ -72,9 +60,9 @@
- nop:
- socket_file_checking:
socket_file_checking = "yes"
only xattr_on.flock_off.lock_posix_off.cache_mode_none, externally_launched_fs_test
only xattr_on.cache_mode_auto, externally_launched_fs_test
- lifecycle:
only xattr_on.flock_off.lock_posix_off.cache_mode_none..one_fs
only xattr_on.cache_mode_auto..one_fs
variants:
- suspend_resume:
suspend_resume = "yes"
Expand All @@ -93,16 +81,16 @@
source_dir = "/var/tmp/mount_tag0"
dev_type = "filesystem"
vm_attrs = {'mb': {"source_type":"file", 'access_mode': 'shared'}}
fs_dict = {'accessmode':'passthrough', 'driver': {'type': 'virtiofs', 'queue':'512'}, 'source':{'dir': '${source_dir}'}, "target": {'dir': 'mount_tag0'}, 'binary': {'path': '/usr/libexec/virtiofsd', 'xattr': 'on','cache_mode':'none','lock_posix':'off','flock':'off'}}
fs_dict = {'accessmode':'passthrough', 'driver': {'type': 'virtiofs', 'queue':'512'}, 'source':{'dir': '${source_dir}'}, "target": {'dir': 'mount_tag0'}, 'binary': {'path': '/usr/libexec/virtiofsd', 'xattr': 'on','cache_mode':'always'}}
- coldplug_coldunplug:
only xattr_on.flock_off.lock_posix_off.cache_mode_none..one_fs
only xattr_on.cache_mode_auto..one_fs
coldplug = "yes"
- hotplug_unplug:
hotplug_unplug = "yes"
variants:
- detach_device_alias:
detach_device_alias = "yes"
only xattr_on.flock_off.lock_posix_off.cache_mode_none
only xattr_on.cache_mode_auto
variants:
- stdio_handler:
variants:
Expand All @@ -127,7 +115,7 @@
with_hugepages = no
with_memfd = yes
- negative_test:
only fs_test.xattr_on.flock_off.lock_posix_off.cache_mode_none..one_fs.one_guest
only fs_test.xattr_on.cache_mode_auto..one_fs.one_guest
status_error = "yes"
variants:
- invalid_queue_size:
Expand Down
35 changes: 14 additions & 21 deletions libvirt/tests/src/virtual_device/filesystem_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,23 @@ def run(test, params, env):
5.Lifecycle for guest with virtiofs filesystem device.
"""

def generate_expected_process_option(expected_results):
def generate_expected_process_option():
"""
Generate expected virtiofsd process option
"""
expected_results = ""
if cache_mode != "auto":
expected_results = "cache=%s" % cache_mode
expected_results += "cache(\s|=)%s" % cache_mode
if xattr == "on":
expected_results += ",xattr"
elif xattr == "off":
expected_results += "(\s--|,)xattr"
elif xattr == "off" and not libvirt_version.version_compare(10, 5, 0):
expected_results += ",no_xattr"
if flock == "on":
expected_results += ",flock"
else:
expected_results += ",no_flock"
if lock_posix == "on":
expected_results += ",posix_lock"
else:
expected_results += ",no_posix_lock"
if thread_pool_size:
expected_results += " --thread-pool-size=%s" % thread_pool_size
# Even through there is a equal mark between --thread-pool-size and
# its value for libvirt format. But there is no equal mark in
# 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
logging.debug(expected_results)
return expected_results

Expand Down Expand Up @@ -223,8 +220,6 @@ def check_filesystem_hotplug_with_mem_setup():
vm_names = params.get("vms", "avocado-vt-vm1").split()
cache_mode = params.get("cache_mode", "none")
xattr = params.get("xattr", "on")
lock_posix = params.get("lock_posix", "on")
flock = params.get("flock", "on")
xattr = params.get("xattr", "on")
path = params.get("virtiofsd_path", "/usr/libexec/virtiofsd")
thread_pool_size = params.get("thread_pool_size")
Expand Down Expand Up @@ -260,7 +255,6 @@ def check_filesystem_hotplug_with_mem_setup():
vms = []
vmxml_backups = []
expected_fails_msg = []
expected_results = ""
host_hp_size = utils_memory.get_huge_page_size()
backup_huge_pages_num = utils_memory.get_num_huge_pages()
huge_pages_num = 0
Expand Down Expand Up @@ -292,10 +286,8 @@ 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', 'lock_posix',
'flock', 'thread_pool_size']
binary_values = [path, cache_mode, xattr, lock_posix,
flock, thread_pool_size]
binary_keys = ['path', 'cache_mode', 'xattr', 'thread_pool_size']
binary_values = [path, cache_mode, xattr, thread_pool_size]
binary_dict = dict(zip(binary_keys, binary_values))
source = {'dir': source_dir}
accessmode = "passthrough"
Expand All @@ -318,6 +310,7 @@ def check_filesystem_hotplug_with_mem_setup():
vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_names[index])
vmxml_backup = vmxml.copy()
vmxml_backups.append(vmxml_backup)
logging.debug(fs_dev)
if vmxml.max_mem < 1024000:
vmxml.max_mem = 1024000
if with_hugepages:
Expand Down Expand Up @@ -365,7 +358,7 @@ def check_filesystem_hotplug_with_mem_setup():
return
else:
utils_test.libvirt.check_exit_status(result, expect_error=False)
expected_results = generate_expected_process_option(expected_results)
expected_results = generate_expected_process_option()
if launched_mode == "auto":
cmd = 'ps aux | grep /usr/libexec/virtiofsd'
utils_test.libvirt.check_cmd_output(cmd, content=expected_results)
Expand Down

0 comments on commit 9ea3a9b

Please sign in to comment.