setup.sh: do not use lsblk -o SUBSYSTEMS

It's apparently unavailable on some systems.
We used it to grep all Virtio-PCI block devices
before matching them against our desired PCI bdf
in get_virtio_names_from_bdf(). If we were unbinding
a Virtio-PCI device and lsblk failed, the script
assumed there were no block devices and hence no
active mountpoints for that Virtio device. The initial
grep is not necessary and, since it's causing us
troubles, is now being removed.

Change-Id: I5a621391dc4772b2bd67eaa832e318d9a0d25948
Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/401780
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Dariusz Stojaczyk 2018-02-28 09:11:09 +01:00 committed by Daniel Verkamp
parent 6140f2d147
commit 252d418c40

View File

@ -131,14 +131,12 @@ function get_nvme_name_from_bdf {
}
function get_virtio_names_from_bdf {
set +e
virtio_ctrlrs=`lsblk --nodeps --output "NAME,SUBSYSTEMS" | grep virtio | awk '{print $1}'`
set -e
blk_devs=`lsblk --nodeps --output NAME`
virtio_names=''
for ctrlr in $virtio_ctrlrs; do
if readlink "/sys/block/$ctrlr" | grep -q "$1"; then
virtio_names="$virtio_names $ctrlr"
for dev in $blk_devs; do
if readlink "/sys/block/$dev" | grep -q "$1"; then
virtio_names="$virtio_names $dev"
fi
done