scripts/setup: Check that numa_node exists before reading

On non NUMA architectures the numa_node sysfs entry doesn't exist.
Check if it exists before reading to prevent an error causing 'status'
to fail.

Reviewed-by: Qingmin Liu <qingmin.liu@broadcom.com>
Tested-by: Jonathan Richardson <jonathan.richardson@broadcom.com>
Reviewed-by: Jonathan Richardson <jonathan.richardson@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Jonathan Richardson <jonathan.richardson@broadcom.com>
Change-Id: Iacf5b062a4f5db5e049d2cfcff7c991d4ac5d3c3
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448576
Reviewed-by: Scott Branden <sbranden@gmail.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Qingmin Liu <calmarrow@gmail.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Qingmin Liu 2019-03-12 17:39:09 +08:00 committed by Darek Stojaczyk
parent 93984d25d6
commit 30bfdc9cc9

View File

@ -487,7 +487,11 @@ function status_linux {
echo -e "BDF\t\tVendor\tDevice\tNUMA\tDriver\t\tDevice name"
for bdf in $(iter_all_pci_class_code 01 08 02); do
driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}')
node=$(cat /sys/bus/pci/devices/$bdf/numa_node)
if [ "$numa_nodes" = "0" ]; then
node="-"
else
node=$(cat /sys/bus/pci/devices/$bdf/numa_node)
fi
device=$(cat /sys/bus/pci/devices/$bdf/device)
vendor=$(cat /sys/bus/pci/devices/$bdf/vendor)
if [ "$driver" = "nvme" -a -d /sys/bus/pci/devices/$bdf/nvme ]; then
@ -508,7 +512,11 @@ function status_linux {
for dev_id in $TMP; do
for bdf in $(iter_all_pci_dev_id 8086 $dev_id); do
driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}')
node=$(cat /sys/bus/pci/devices/$bdf/numa_node)
if [ "$numa_nodes" = "0" ]; then
node="-"
else
node=$(cat /sys/bus/pci/devices/$bdf/numa_node)
fi
device=$(cat /sys/bus/pci/devices/$bdf/device)
vendor=$(cat /sys/bus/pci/devices/$bdf/vendor)
echo -e "$bdf\t${vendor#0x}\t${device#0x}\t$node\t${driver:--}"
@ -525,7 +533,11 @@ function status_linux {
for dev_id in $TMP; do
for bdf in $(iter_all_pci_dev_id 1af4 $dev_id); do
driver=$(grep DRIVER /sys/bus/pci/devices/$bdf/uevent |awk -F"=" '{print $2}')
node=$(cat /sys/bus/pci/devices/$bdf/numa_node)
if [ "$numa_nodes" = "0" ]; then
node="-"
else
node=$(cat /sys/bus/pci/devices/$bdf/numa_node)
fi
device=$(cat /sys/bus/pci/devices/$bdf/device)
vendor=$(cat /sys/bus/pci/devices/$bdf/vendor)
blknames=''