test/nvme: do not use mounted nvme disks in perf script

For kernel-* mode do not use mounted nvme disks for tests.

This was not checked previously and could result in losing
all data on NVMes not meant to be used in test.

Change-Id: I336c95b8e79e2592897c6b354e5a20a9c86f1482
Signed-off-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460326
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Karol Latecki 2019-07-03 14:11:05 +02:00 committed by Jim Harris
parent aec3021924
commit db330b7441

View File

@ -26,6 +26,13 @@ NUMJOBS=1
REPEAT_NO=3
NOIOSCALING=false
function is_bdf_not_mounted() {
local bdf=$1
local blkname=$(ls -l /sys/block/ | grep $bdf | awk '{print $9}')
local mountpoints=$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w)
return $mountpoints
}
function get_cores(){
local cpu_list="$1"
for cpu in ${cpu_list//,/ }; do
@ -58,8 +65,11 @@ function get_numa_node(){
echo $(cat /sys/bus/pci/devices/$bdev_bdf/numa_node)
done
else
# Only target not mounted NVMes
for bdf in $(iter_pci_class_code 01 08 02); do
if is_bdf_not_mounted $bdf; then
echo $(cat /sys/bus/pci/devices/$bdf/numa_node)
fi
done
fi
}
@ -77,8 +87,12 @@ function get_disks(){
local bdevs=$(discover_bdevs $ROOT_DIR $BASE_DIR/bdev.conf)
echo $(jq -r '.[].name' <<< $bdevs)
else
# Only target not mounted NVMes
for bdf in $(iter_pci_class_code 01 08 02); do
echo $(ls -l /sys/block/ | grep $bdf |awk '{print $9}')
if is_bdf_not_mounted $bdf; then
local blkname=$(ls -l /sys/block/ | grep $bdf | awk '{print $9}')
echo $blkname
fi
done
fi
}
@ -183,8 +197,14 @@ function preconditioning(){
local filename=""
local i
sed -i -e "\$a[preconditioning]" $BASE_DIR/config.fio
for bdf in $(iter_pci_class_code 01 08 02); do
dev_name='trtype=PCIe traddr='${bdf//:/.}' ns=1'
# Generate filename argument for FIO.
# We only want to target NVMes not bound to nvme driver.
# If they're still bound to nvme that means they were skipped by
# setup.sh on purpose.
local nvme_list=$(get_disks nvme)
for nvme in $nvme_list; do
dev_name='trtype=PCIe traddr='${nvme//:/.}' ns=1'
filename+=$(printf %s":" "$dev_name")
done
echo "** Preconditioning disks, this can take a while, depending on the size of disks."