nvme/tests: Enable testing multinamespace NVMe

This patch removes restriction for using only first
namespace when testing nvme cli and includes other
namespaces than first one in nvme fio tests.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: I047f85520b441313cf1788c06d8f4c7d7ef4e162
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457643
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Maciej Szwed 2019-06-11 15:04:06 +02:00 committed by Ben Walker
parent 521bd911c8
commit 1500eb7b11
2 changed files with 32 additions and 28 deletions

View File

@ -6,7 +6,8 @@ source $rootdir/scripts/common.sh
source $rootdir/test/common/autotest_common.sh
function get_nvme_name_from_bdf {
lsblk -d --output NAME
blkname=()
nvme_devs=$(lsblk -d --output NAME | grep "^nvme") || true
if [ -z "$nvme_devs" ]; then
return
@ -18,10 +19,11 @@ function get_nvme_name_from_bdf {
fi
bdf=$(basename "$link_name")
if [ "$bdf" = "$1" ]; then
eval "$2=$dev"
return
blkname+=($dev)
fi
done
printf '%s\n' "${blkname[@]}"
}
timing_enter nvme
@ -40,15 +42,16 @@ if [ $(uname) = Linux ]; then
# note: more work probably needs to be done to properly handle devices with multiple
# namespaces
for bdf in $(iter_pci_class_code 01 08 02); do
get_nvme_name_from_bdf "$bdf" blkname
if [ "$blkname" != "" ]; then
mountpoints=$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w)
if [ "$mountpoints" = "0" ]; then
break
else
blkname=''
for blkname in $(get_nvme_name_from_bdf $bdf); do
if [ "$blkname" != "" ]; then
mountpoints=$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w)
if [ "$mountpoints" = "0" ]; then
break
else
blkname=''
fi
fi
fi
done
done
# if we found an NVMe block device without an active mountpoint, create and mount
@ -164,8 +167,10 @@ if [ -d /usr/src/fio ]; then
timing_enter fio_plugin
PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin
for bdf in $(iter_pci_class_code 01 08 02); do
fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=1"
report_test_completion "bdev_fio"
for blkname in $(get_nvme_name_from_bdf $bdf); do
fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=PCIe traddr=${bdf//:/.} ns=${blkname##*n}"
report_test_completion "bdev_fio"
done
done
timing_exit fio_plugin
fi

View File

@ -28,25 +28,24 @@ fi
rm -f "$spdk_nvme_cli/spdk"
ln -sf "$rootdir" "$spdk_nvme_cli/spdk"
bdfs=$(iter_pci_class_code 01 08 02)
bdf=$(echo $bdfs|awk '{ print $1 }')
cd $spdk_nvme_cli
make clean && make -j$(nproc) LDFLAGS="$(make -s -C $spdk_nvme_cli/spdk ldflags)"
sed -i 's/spdk=0/spdk=1/g' spdk.conf
sed -i 's/shm_id=.*/shm_id=0/g' spdk.conf
./nvme list
./nvme id-ctrl $bdf
./nvme list-ctrl $bdf
./nvme get-ns-id $bdf
./nvme id-ns $bdf
./nvme fw-log $bdf
./nvme smart-log $bdf
./nvme error-log $bdf
./nvme list-ns $bdf -n 1
./nvme get-feature $bdf -n 1 -f 1 -s 1 -l 100
./nvme get-log $bdf -n 1 -i 1 -l 100
./nvme reset $bdf
for bdf in $(iter_pci_class_code 01 08 02); do
./nvme list
./nvme id-ctrl $bdf
./nvme list-ctrl $bdf
./nvme get-ns-id $bdf
./nvme id-ns $bdf
./nvme fw-log $bdf
./nvme smart-log $bdf
./nvme error-log $bdf
./nvme list-ns $bdf -n 1
./nvme get-feature $bdf -f 1 -s 1 -l 100
./nvme get-log $bdf -i 1 -l 100
./nvme reset $bdf
done
if [ $(uname) = Linux ]; then
trap - SIGINT SIGTERM EXIT
kill_stub