Spdk/test/setup/acl.sh

49 lines
1008 B
Bash
Raw Normal View History

#!/usr/bin/env bash
testdir=$(readlink -f "$(dirname "$0")")
rootdir=$(readlink -f "$testdir/../../")
source "$testdir/common.sh"
declare -a devs=()
declare -A drivers=()
collect_setup_devs() {
local dev driver
while read -r _ dev _ _ _ driver _; do
[[ $dev == *:*:*.* ]] || continue
[[ $driver == nvme ]] || continue
devs+=("$dev") drivers["$dev"]=$driver
done < <(setup output status)
((${#devs[@]} > 0))
}
verify() {
local dev driver
for dev; do
[[ -e /sys/bus/pci/devices/$dev ]]
driver=$(readlink -f "/sys/bus/pci/devices/$dev/driver")
[[ ${drivers["$dev"]} == "${driver##*/}" ]]
done
}
denied() {
scripts/vagrant: Drop OCSSD awareness from functional tests This also translates into switching fully to upstream QEMU for the vagrant setup. This is done in order to move away from OCSSD and SPDK's qemu fork and align with what upstream QEMU supports. Main changes touch the way how nvme namespaces are configured. With >= 5.2.0 it's possible now to configure multiple namespace under single nvme device. Each namespace requires a separate disk image to work with. This: -b foo.img,nvme,1... -b foo.img -b foo.img,,.. Will still configure nvme controller with a single namespace attached to foo.img. This: -b foo.img,,foo-ns1.img:foo-ns2.img Will configure nvme controller with three namespaces. Configuring nvme controller with no namespaces is possible via: -b none ... Note that this still allows to define other options specific to nvme controller, like CMB and PMR. E.g: -b none,nvme,,true This will create nvme controller with no namespaces but with CMB enabled. It's possible now to also request for given controller to be zoned. Currently if requsted, all namespaces under the target controller will be zoned with no limit set as to max open|active zones. All nvme devices have block size fixed to 4KB to imititate behavior of the SPDK's qemu fork. Compatibility with spdk-5.0.0 fork is preserved in context of setting up namespaces so this: -b foo.img,nvme,2 is valid as long as the emulator is set to that of spdk-5.0.0's. Signed-off-by: Michal Berger <michalx.berger@intel.com> Change-Id: Ib5d53cb5c330c1f84b57e0bf877ea0e2d0312ddd Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8421 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
2021-06-17 16:44:43 +00:00
PCI_BLOCKED="${devs[0]}" setup output config \
| grep "Skipping denied controller at ${devs[0]}"
verify "${devs[0]}"
setup reset
}
allowed() {
PCI_ALLOWED="${devs[0]}" setup output config \
| grep -E "${devs[0]} .*: ${drivers["${devs[0]}"]} -> .*"
verify "${devs[@]:1}"
setup reset
}
setup reset
collect_setup_devs
run_test "denied" denied
run_test "allowed" allowed