diff --git a/libvirt/tests/cfg/virtual_device/filesystem_device.cfg b/libvirt/tests/cfg/virtual_device/filesystem_device.cfg index 22ab89a0c46..4a754c3821b 100644 --- a/libvirt/tests/cfg/virtual_device/filesystem_device.cfg +++ b/libvirt/tests/cfg/virtual_device/filesystem_device.cfg @@ -86,6 +86,13 @@ bug_url = "https://bugzilla.redhat.com/show_bug.cgi?id=1940276" destroy_start = "yes" stress_script = "#!/usr/bin/python3;import os;while True:; os.open("%s/moo", os.O_CREAT | os.O_RDWR); os.unlink("%s/moo");" + - restart_service: + only file_backed + setup_mem = True + 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'}} - coldplug_coldunplug: only xattr_on.flock_off.lock_posix_off.cache_mode_none..one_fs coldplug = "yes" diff --git a/libvirt/tests/src/virtual_device/filesystem_device.py b/libvirt/tests/src/virtual_device/filesystem_device.py index 7f621f8b7ae..37da2210ac5 100644 --- a/libvirt/tests/src/virtual_device/filesystem_device.py +++ b/libvirt/tests/src/virtual_device/filesystem_device.py @@ -18,6 +18,7 @@ from virttest.utils_test import libvirt_device_utils from virttest.utils_test import libvirt from virttest.utils_libvirt import libvirt_pcicontr +from virttest.utils_libvirt import libvirt_vmxml # Using as lower capital is not the best way to do, but this is just a @@ -222,6 +223,11 @@ def check_filesystem_in_guest(vm, fs_dev): bug_url = params.get("bug_url", "") script_content = params.get("stress_script", "") stdio_handler_file = "file" == params.get("stdio_handler") + setup_mem = params.get("setup_mem", False) + vm_attrs = eval(params.get('vm_attrs', '{}')) + fs_dict = eval(params.get('fs_dict', '{}')) + source_dir = params.get('source_dir') + dev_type = params.get('dev_type') fs_devs = [] vms = [] @@ -245,6 +251,26 @@ def check_filesystem_in_guest(vm, fs_dev): test.cancel("Bug %s is not fixed on current build" % bug_url) try: + if setup_mem: + vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(vm_names[int(guest_num)-1]) + vmxml.setup_attrs(**vm_attrs) + virsh.define(vmxml.xml, debug=True, ignore_status=False) + + libvirtd = utils_libvirtd.Libvirtd() + libvirtd.restart() + + vmxml = vm_xml.VMXML.new_from_dumpxml(vm_names[int(guest_num)-1]) + vmxml.remove_all_device_by_type(dev_type) + vmxml.sync() + vm = env.get_vm(vm_names[int(guest_num)-1]) + vm.start() + vm.wait_for_login(timeout=120) + os.mkdir(source_dir) + + fs = libvirt_vmxml.create_vm_device_by_type(dev_type, fs_dict) + virsh.attach_device(vm_names[int(guest_num)-1], fs.xml, + debug=True, ignore_status=False) + return # Define filesystem device xml for index in range(fs_num): driver = {'type': driver_type, 'queue': queue_size}