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

virtiofs : add case for restart service after config shared memory #5004

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
8 changes: 8 additions & 0 deletions libvirt/tests/cfg/virtual_device/filesystem_device.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, the manual case is indicated explicitly. The scenario can be expanded to all the memory backed type, not just the file type. We can remove this only condition. Thanks

Copy link
Contributor Author

@nanli1 nanli1 Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we just write this code instead of modular cases ,Do you update this case later?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I made a mistake
"Sorry, the manual case is NOT indicated explicitly". I lost "NOT"

func_supported_since_libvirt_ver = (9, 2, 0)
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"
Expand Down
37 changes: 37 additions & 0 deletions libvirt/tests/src/virtual_device/filesystem_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -187,6 +188,37 @@ def check_filesystem_in_guest(vm, fs_dev):
test.fail("Mount virtiofs should failed after hotunplug device. %s" % output)
session.close()

def check_filesystem_hotplug_with_mem_setup():
"""
Check libvirt can not identify shared memory after restarting
virtqemud.
Bug 2078693
"""
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')

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)

start_vm = params.get("start_vm", "no")
vm_names = params.get("vms", "avocado-vt-vm1").split()
cache_mode = params.get("cache_mode", "none")
Expand Down Expand Up @@ -222,6 +254,7 @@ 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)

fs_devs = []
vms = []
Expand All @@ -245,6 +278,10 @@ def check_filesystem_in_guest(vm, fs_dev):
test.cancel("Bug %s is not fixed on current build" % bug_url)

try:
if setup_mem:
libvirt_version.is_libvirt_feature_supported(params)
check_filesystem_hotplug_with_mem_setup()
return
# Define filesystem device xml
for index in range(fs_num):
driver = {'type': driver_type, 'queue': queue_size}
Expand Down
Loading