196 lines
8.7 KiB
Diff
196 lines
8.7 KiB
Diff
commit dd6da6b329bac2743d1c80b5556b494c923c11ad
|
|
Author: Michael Bringmann <mwb@linux.vnet.ibm.com>
|
|
Date: Mon Apr 29 11:25:18 2019 -0500
|
|
|
|
scripts: Improve handling of errors from subsidiary scripts
|
|
|
|
This patch is to fix the handling of errors by 'lsdevinfo' from
|
|
invocations of 'ofpathname' that also encounter errors. Error
|
|
messages from 'ofpathname' were being sent through 'stdout', and
|
|
interpreted as valid data by a number of script instructions in
|
|
'lsdevinfo'. Following is an example of such a failure when the
|
|
error results were forwarded to an associated HMC.
|
|
|
|
2019-02-19 22:05:38.212 [TID-5f68--72195] VIOS_CACHE: CacheVios.<-> saveCacheData 3*9080-M9S*130A068 cmd=lsdevinfo -c -q physloc=U78CD.001.FZH0128-P1-C1-T3-S4 -F status
|
|
2019-02-19 22:05:38.212 [TID-5f68--72195] RMC_VIOS: PIRmcViosClient.stdErr=/bin/ls: cannot access /sys/class/net/ofpathname:: No such file or directory
|
|
/bin/ls: cannot access Could: No such file or directory
|
|
/bin/ls: cannot access not: No such file or directory
|
|
/bin/ls: cannot access retrieve: No such file or directory
|
|
/bin/ls: cannot access logical: No such file or directory
|
|
/bin/ls: cannot access device: No such file or directory
|
|
/bin/ls: cannot access name: No such file or directory
|
|
/bin/ls: cannot access for: No such file or directory
|
|
/bin/ls: cannot access Open: No such file or directory
|
|
/bin/ls: cannot access Firmware: No such file or directory
|
|
/bin/ls: cannot access path: No such file or directory
|
|
/bin/ls: cannot access "/pci@800000029008004/ethernet@0"./device/driver: No such file or directory
|
|
|
|
This patch makes the following changes:
|
|
|
|
* Redirects the error messages from 'ofpathname' to stderr
|
|
* Adds more checks to 'lsdevinfo' to filter out stderr text
|
|
from input to various parsing commands.
|
|
|
|
Signed-off-by: Michael Bringmann <mwb@linux.vnet.ibm.com>
|
|
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
|
|
|
|
diff --git a/scripts/lsdevinfo b/scripts/lsdevinfo
|
|
index 4ef98d7..85019e9 100755
|
|
--- a/scripts/lsdevinfo
|
|
+++ b/scripts/lsdevinfo
|
|
@@ -225,7 +225,7 @@ show_eth ()
|
|
# Look at every vNIC device
|
|
for dev in $($LS -d /proc/device-tree/vdevice/vnic* 2> /dev/null); do
|
|
# use ofpathname to get the device name (i.e. eth0)
|
|
- name=$($OFPATHNAME -l $(echo $dev | $SED -e "s/\/proc\/device-tree//"))
|
|
+ name=$($OFPATHNAME -l $(echo $dev | $SED -e "s/\/proc\/device-tree//") 2> /dev/null)
|
|
connection=$(echo $dev | $SED -e "s/\/proc\/device-tree\/vdevice\/l-lan@//")
|
|
parent="vio"
|
|
|
|
@@ -246,7 +246,7 @@ done
|
|
# Look at every ibmveth (Virtual Ethernet) device
|
|
for dev in $($LS -d /proc/device-tree/vdevice/l-lan* 2> /dev/null); do
|
|
# use ofpathname to get the device name (i.e. eth0)
|
|
- name=$($OFPATHNAME -l $(echo $dev | $SED -e "s/\/proc\/device-tree//"))
|
|
+ name=$($OFPATHNAME -l $(echo $dev | $SED -e "s/\/proc\/device-tree//") 2> /dev/null)
|
|
connection=$(echo $dev | $SED -e "s/\/proc\/device-tree\/vdevice\/l-lan@//")
|
|
parent="vio"
|
|
|
|
@@ -268,7 +268,7 @@ done
|
|
for pci_dev in $($LS -d /proc/device-tree/pci* 2> /dev/null); do
|
|
for dev in $($LS -d $pci_dev/ethernet* 2> /dev/null); do
|
|
# use ofpathname to get the device name (i.e. eth0)
|
|
- name=$($OFPATHNAME -l $(echo $dev | $SED -e "s/\/proc\/device-tree//"))
|
|
+ name=$($OFPATHNAME -l $(echo $dev | $SED -e "s/\/proc\/device-tree//") 2> /dev/null)
|
|
connection=$(echo $pci_dev | $SED -e "s/\/proc\/device-tree\/pci@//")
|
|
parent="pci"
|
|
|
|
@@ -280,7 +280,7 @@ for pci_dev in $($LS -d /proc/device-tree/pci* 2> /dev/null); do
|
|
class="adapter"
|
|
subclass="pci"
|
|
prefix="eth"
|
|
- driver=$($LS -l /sys/class/net/$name/device/driver |
|
|
+ driver=$($LS -l /sys/class/net/$name/device/driver 2> /dev/null |
|
|
$SED -e "s/^.*\///")
|
|
status=1
|
|
|
|
@@ -312,11 +312,11 @@ for dev in $($LS -d /proc/device-tree/vdevice/v-scsi* 2> /dev/null) ; do
|
|
prefix="host"
|
|
driver="ibmvscsic"
|
|
|
|
- host=$($LS -d /sys/devices/vio/$slot/host*/)
|
|
+ host=$($LS -d /sys/devices/vio/$slot/host*/ 2> /dev/null)
|
|
if [[ -d $host/scsi_host ]]; then
|
|
- scsihost=$($LS -d $host/scsi_host/host*/)
|
|
+ scsihost=$($LS -d $host/scsi_host/host*/ 2> /dev/null)
|
|
else
|
|
- scsihost=$($LS -d $host/scsi_host*/)
|
|
+ scsihost=$($LS -d $host/scsi_host*/ 2> /dev/null)
|
|
fi
|
|
|
|
if [[ $(cat $scsihost/state) == "running" ]] ; then
|
|
@@ -365,12 +365,12 @@ for dev in $($LS -d /proc/device-tree/vdevice/v-scsi* 2> /dev/null) ; do
|
|
fi
|
|
|
|
# loop through the targets for this host.
|
|
- for t in $($LS -d $host/target*); do
|
|
+ for t in $($LS -d $host/target* 2> /dev/null); do
|
|
target=$(echo $($LS -d $t/$($LS $t | $GREP -v uevent | $GREP -v power | $GREP -v subsystem)))
|
|
if [[ ! -d $target/block ]]; then
|
|
- name=$(echo $($LS -d $target/block*) | $SED -e "s/.*://")
|
|
+ name=$(echo $($LS -d $target/block* 2> /dev/null) | $SED -e "s/.*://")
|
|
else
|
|
- name=$($LS $target/block)
|
|
+ name=$($LS $target/block 2> /dev/null)
|
|
fi
|
|
|
|
conn=$($OFPATHNAME /dev/$name 2> /dev/null | $SED -e "s/.*disk@//")
|
|
@@ -446,7 +446,7 @@ for dev in $($LS -d /proc/device-tree/vdevice/vfc-client* 2> /dev/null) ; do
|
|
slot=$(echo $dev | $SED -e "s/\/proc\/device-tree\/vdevice\/vfc-client@//")
|
|
|
|
# there is only one host per device, assign it to the path's name
|
|
- for host in $($LS -d /sys/devices/vio/$slot/host*) ; do
|
|
+ for host in $($LS -d /sys/devices/vio/$slot/host* 2> /dev/null) ; do
|
|
parent=$(echo $host | $SED -e "s/.*\///")
|
|
name=$parent
|
|
|
|
@@ -457,11 +457,11 @@ for dev in $($LS -d /proc/device-tree/vdevice/vfc-client* 2> /dev/null) ; do
|
|
prefix="host"
|
|
driver="ibmvfc"
|
|
|
|
- host=$($LS -d /sys/devices/vio/$slot/host*/)
|
|
+ host=$($LS -d /sys/devices/vio/$slot/host*/ 2> /dev/null)
|
|
if [[ -d $host/scsi_host ]]; then
|
|
- scsihost=$($LS -d $host/scsi_host/host*/)
|
|
+ scsihost=$($LS -d $host/scsi_host/host*/ 2> /dev/null)
|
|
else
|
|
- scsihost=$($LS -d $host/scsi_host*/)
|
|
+ scsihost=$($LS -d $host/scsi_host*/ 2> /dev/null)
|
|
fi
|
|
|
|
if [[ $(cat $scsihost/state) == "running" ]] ; then
|
|
@@ -510,16 +510,16 @@ for dev in $($LS -d /proc/device-tree/vdevice/vfc-client* 2> /dev/null) ; do
|
|
fi
|
|
|
|
# As opposed to ibmvscsi, there are multiple rports in each host
|
|
- for rport in $($LS -d $host/rport*); do
|
|
+ for rport in $($LS -d $host/rport* 2> /dev/null); do
|
|
|
|
# in ibmvfc there are two layers of directories before getting to
|
|
# the targets
|
|
- for t in $($LS -d $rport/target*); do
|
|
+ for t in $($LS -d $rport/target* 2> /dev/null); do
|
|
for target in $($LS $t | $GREP "[0-9]*:[0-9]*:[0-9]*:[0-9]*"); do
|
|
if [[ ! -d $t/$target/block ]]; then
|
|
name=$(echo $($LS -d $t/$target/block*) | $SED -e "s/.*://")
|
|
else
|
|
- name=$($LS $t/$target/block)
|
|
+ name=$($LS $t/$target/block 2> /dev/null)
|
|
fi
|
|
|
|
connection=$($OFPATHNAME /dev/$name 2> /dev/null | $SED -e "s/.*disk@//")
|
|
diff --git a/scripts/ofpathname b/scripts/ofpathname
|
|
index 1b2a1dd..c37c6bd 100755
|
|
--- a/scripts/ofpathname
|
|
+++ b/scripts/ofpathname
|
|
@@ -84,20 +84,20 @@ err()
|
|
fi
|
|
|
|
case $emsg in
|
|
- 1) echo "$OFPATHNAME: Could not retrieve Open Firmware device path"
|
|
- echo " for logical device \"$DEVNAME_ARG\"." ;;
|
|
+ 1) echo "$OFPATHNAME: Could not retrieve Open Firmware device path" 1>&2
|
|
+ echo " for logical device \"$DEVNAME_ARG\"." 1>&2 ;;
|
|
|
|
- 2) echo "$OFPATHNAME: sysfs (/sys) is needed and does not appear"
|
|
- echo " to be mounted on this system." ;;
|
|
+ 2) echo "$OFPATHNAME: sysfs (/sys) is needed and does not appear" 1>&2
|
|
+ echo " to be mounted on this system." 1>&2 ;;
|
|
|
|
- 3) echo "$OFPATHNAME: Could not find sysfs information for logical"
|
|
- echo " device \"$DEVNAME_ARG\"." ;;
|
|
+ 3) echo "$OFPATHNAME: Could not find sysfs information for logical" 1>&2
|
|
+ echo " device \"$DEVNAME_ARG\"." 1>&2 ;;
|
|
|
|
- 4) echo "$OFPATHANME: Logical device \"$DEVNAME_ARG\" does not appear"
|
|
- echo " to be configured." ;;
|
|
+ 4) echo "$OFPATHANME: Logical device \"$DEVNAME_ARG\" does not appear" 1>&2
|
|
+ echo " to be configured." 1>&2 ;;
|
|
|
|
- 5) echo "$OFPATHNAME: Could not retrieve logical device name for"
|
|
- echo " Open Firmware path \"$DEVNAME_ARG\"."
|
|
+ 5) echo "$OFPATHNAME: Could not retrieve logical device name for" 1>&2
|
|
+ echo " Open Firmware path \"$DEVNAME_ARG\"." 1>&2 ;;
|
|
esac
|
|
|
|
exit 1
|
|
@@ -1631,7 +1631,7 @@ of2l_nvme()
|
|
#
|
|
. $PSERIES_PLATFORM
|
|
if [[ $platform = $PLATFORM_POWERNV ]]; then
|
|
- echo "$OFPATHNAME: is not supported on the $platform_name platform"
|
|
+ echo "$OFPATHNAME: is not supported on the $platform_name platform" 1>&2
|
|
exit 1
|
|
fi
|
|
|