Skip to content

Commit

Permalink
filesystem_device: test usage for unprivileged users
Browse files Browse the repository at this point in the history
Add new test cases checking that non-root users can mount
and use a host directory.

Variants:
2 vms, 1 filesystem
1 vm, 1 filesystem
1 vm, 2 filesystems

Notes:
1. use wait_for_serial login because the unprivileged user's VMs
   are created with interface type 'user' per default, so there's
   no vnet nic and therefore wait_for_login can't get the address
2. Due to 1. it's better to use the 'safe' command functions to avoid
   timeouts because there might be kernel messages breaking the
   output scan.
3. For hugepages, the unprivileged user needs access to a hugetlbfs
   and update their local libvirt configuration. After updating
   the configuration, the process needs to be killed to force
   the daemon to be loaded with the new configuration. This is
   expected.
4. Make sure to close and reopen sessions for the virsh instance
   of the unprivileged user to avoid running into issues when setting
   up hugepages.
5. virsh_sysinfo: update reference after change in avocado-vt that
   this test implementation depends on.

Signed-off-by: Sebastian Mitterle <[email protected]>
  • Loading branch information
smitterl committed May 20, 2024
1 parent 3a5d936 commit 79f6010
Show file tree
Hide file tree
Showing 4 changed files with 445 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
- virtual_devices.filesystem_device_unprivileged:
type = filesystem_device_unprivileged
# 10.0.0-6
func_supported_since_libvirt_ver = (10, 0, 0)
take_regular_screendumps = "no"
start_vm = no
vcpus_per_cell = 2
extra_hugepages = 128
test_user = test
test_passwd = test
pseries:
vcpus_per_cell = 5
aarch64:
extra_hugepages = 0
s390-virtio:
with_numa = no
variants plugmode:
- hotplug:
- coldplug:
variants:
- one_guest:
unpr_vms = unpr-vm
- two_guests:
unpr_vms = unpr-vm,unpr-vm2
variants memorybacking:
- with_hugepages:
s390-virtio:
kvm_module_parameters = hpage=1
- with_memfd:
- with_shm:
variants:
- one_fs:
fs_dicts = [{'accessmode': 'passthrough', 'source': {'dir': '/tmp/dir1'}, "target": {'dir': 'mount_tag1'}, 'binary': {'path':'/usr/libexec/virtiofsd', 'lock_posix':'off','flock':'off', 'sandbox_mode':'namespace', 'xattr':'on', 'cache_mode':'none'}, 'driver': {'type': 'virtiofs', 'queue':'1024'}}]
- two_fs:
fs_dicts = [{'accessmode': 'passthrough', 'source': {'dir': '/tmp/dir1'}, "target": {'dir': 'mount_tag1'}, 'binary': {'lock_posix':'off','flock':'off', 'sandbox_mode':'namespace'}, 'driver': {'type': 'virtiofs'}}, {'accessmode': 'passthrough', 'source': {'dir': '/tmp/dir2'}, "target": {'dir': 'mount_tag2'}, 'binary': {'lock_posix':'off','flock':'off', 'sandbox_mode':'namespace', 'xattr':'on', 'cache_mode':'none'}, 'driver': {'type': 'virtiofs'}}]
2 changes: 1 addition & 1 deletion libvirt/tests/src/virsh_cmd/host/virsh_sysinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def run(test, params, env):
dmidecode_version = get_processor_version()
if dmidecode_version:
# Get processor version from result
sysinfo_xml = libvirt_xml.SysinfoXML()
sysinfo_xml = libvirt_xml.VMSysinfoXML()
sysinfo_xml['xml'] = output
sysinfo_xml.xmltreefile.write()

Expand Down
Loading

0 comments on commit 79f6010

Please sign in to comment.