Skip to content

Commit

Permalink
Merge pull request os-autoinst#20376 from mloviska/pv_usb_priv
Browse files Browse the repository at this point in the history
Test access to usb device from a container
  • Loading branch information
mloviska authored Oct 11, 2024
2 parents 0a295e5 + 70dbf77 commit 633f61d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/containers/privileged_mode.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,23 @@ sub run {
# xen-pv does not define USB passthrough in the xml as of now
# this feature has to be added -> https://progress.opensuse.org/issues/138410
assert_script_run("$runtime run --rm $image bash -c '! test -d /dev/bus'");
assert_script_run("$runtime run --rm --privileged $image ls /dev/bus") unless (is_s390x || is_public_cloud || is_xen_pv || is_hyperv || is_vmware);
assert_script_run("$runtime run --rm --privileged $image ls /dev/bus") unless (is_s390x || is_public_cloud || is_hyperv || is_vmware);

# syscalls availability
if ($runtime eq 'podman') {
script_run("$runtime run --rm -d $image bash -c 'sleep infinity'");
assert_script_run("$runtime top -l seccomp | grep filter");
script_run("$runtime run --rm -d --privileged $image bash -c 'sleep infinity'");
assert_script_run("$runtime top -l seccomp | grep disabled");
}

# Mounting tmpfs only works in privileged mode because the read-only protection in the default mode
assert_script_run("$runtime run --rm --privileged $image mount -t tmpfs none /mnt");

# check how were kernel filesystem mounted
assert_script_run("$runtime run --rm $image mount | grep '\(ro'");
assert_script_run("$runtime run --rm --privileged $image mount | grep '\(rw'");

# Capabilities are only available in privileged mode
my $capbnd = script_output("cat /proc/1/status | grep CapBnd");
validate_script_output("$runtime run --rm --privileged $image cat /proc/1/status | grep CapBnd", sub { m/$capbnd/ });
Expand Down
3 changes: 3 additions & 0 deletions tests/installation/bootloader_svirt.pm
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ sub run {
});
}

if ($vmm_family eq 'xen' && $vmm_type eq 'linux') {
$svirt->add_usb_hub();
}
$svirt->add_vnc({port => get_var('VIRSH_INSTANCE', 1) + 5900});

my %ifacecfg = ();
Expand Down

0 comments on commit 633f61d

Please sign in to comment.