test/ocf: Don't depend on gen_nvme.sh while detecting nvme ctrls
gen_nvme.sh requires that all the nvme devices are not bound to the nvme driver which doesn't have to be the case when clear_nvme() is called. To not depend on which driver is in use, simply iterate over pci bus to find a proper device. This avoids additional setup.sh ping-pong which is required to make use of gen_nvme.sh. Additionally, upon exiting, in case mounts for given nvme device were detected, keep the test environment reset to leave nvmes bound to the nvme driver. Change-Id: I428c5e2b0517553d267411a30316bde5d1ce8eef Signed-off-by: Michal Berger <michalx.berger@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1843 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
d3f04b6463
commit
1dfac8ba69
@ -13,15 +13,15 @@ function nvme_cfg() {
|
|||||||
|
|
||||||
function clear_nvme()
|
function clear_nvme()
|
||||||
{
|
{
|
||||||
bdf=$($rootdir/scripts/gen_nvme.sh --json | jq '.config[0].params.traddr' | sed s/\"//g)
|
mapfile -t bdf < <(iter_all_pci_class_code 01 08 02)
|
||||||
|
|
||||||
# Clear metadata on NVMe device
|
# Clear metadata on NVMe device
|
||||||
$rootdir/scripts/setup.sh reset
|
$rootdir/scripts/setup.sh reset
|
||||||
sleep 5
|
sleep 5
|
||||||
name=$(get_nvme_name_from_bdf $bdf)
|
|
||||||
|
name=$(get_nvme_name_from_bdf "${bdf[0]}")
|
||||||
mountpoints=$(lsblk /dev/$name --output MOUNTPOINT -n | wc -w)
|
mountpoints=$(lsblk /dev/$name --output MOUNTPOINT -n | wc -w)
|
||||||
if [ "$mountpoints" != "0" ]; then
|
if [ "$mountpoints" != "0" ]; then
|
||||||
$rootdir/scripts/setup.sh
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
dd if=/dev/zero of=/dev/$name bs=1M count=1000 oflag=direct
|
dd if=/dev/zero of=/dev/$name bs=1M count=1000 oflag=direct
|
||||||
|
Loading…
Reference in New Issue
Block a user