mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
lszfcp: allow to also enumerate FCP device that have never been online
Since zfcp lazily allocates Scsi_Host et al. on setting an FCP device
online for the first time since the last driver core bind to zfcp
(such as zfcp kernel module load),
lszfcp has only been showing FCP devices (vHBAs) that have been online
at least once including those that have been set offline again.
This is somewhat confusing.
Also it would be nice if lszfcp could be an easier to type replacement for
"lscss -t 17032/03" to simply show all devices bound to the zfcp device
driver.
Of course those FCP devices that have never been online, won't have any
zfcp-specific attribute details, only CIO attributes from the CCW bus.
They also do not have a Scsi_Host nor fc_host.
In order not to break any scripting or expectations around lszfcp,
make the new feature depend on the extended output command line option.
Example:
$ lszfcp -He
0.0.1880 - offline
$ lszfcp -HeV
/sys/devices/css0/0.0.010b/0.0.1880 offline
-
-
$ lszfcp -Hea
0.0.1880 - offline
Bus = "ccw"
availability = "good"
cmb_enable = "0"
cutype = "1731/03"
devtype = "1732/03"
modalias = "ccw:t1731m03dt1732dm03"
online = "0"
uevent = "DRIVER=zfcp"
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Fedor Loshakov <loshakov@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
4036e80b26
commit
94b7a8f68d
34
zconf/lszfcp
34
zconf/lszfcp
@@ -59,6 +59,19 @@ check_fcp_devs()
|
||||
ignore=$(ls -dX $SYSFS/devices/css[0-9]*/defunct/[0-9]*/host[0-9]* 2>&1)
|
||||
[ $? -eq 0 ] && found=1
|
||||
fi
|
||||
if [ $found -eq 0 ] && $SHOW_EXTENDED; then
|
||||
local mypath mylist=""
|
||||
# nothing found yet so search for FCP devices never been online
|
||||
for mypath in $SYSFS/bus/ccw/drivers/zfcp/*.*.*; do
|
||||
if [ "$mypath" = "$SYSFS/bus/ccw/drivers/zfcp/*.*.*" ];
|
||||
then
|
||||
break # glob did not match anything
|
||||
fi
|
||||
[ -d $mypath/host[0-9]* ] && continue # is/was online
|
||||
mylist="$mylist $(readlink -e $mypath)/-"
|
||||
done
|
||||
[ -n "$mylist" ] && found=1
|
||||
fi
|
||||
|
||||
if [ $found -eq 0 ]; then
|
||||
echo "Error: No fcp devices found."
|
||||
@@ -150,6 +163,12 @@ show_hosts()
|
||||
# add all "defunct" FCP devices
|
||||
HOST_LIST="$HOST_LIST
|
||||
$(ls -dX $SYSFS/devices/css[0-9]*/defunct/[0-9]*/host[0-9]* 2>/dev/null)"
|
||||
# add all FCP devices that have never been online
|
||||
for HOST_PATH in $SYSFS/bus/ccw/drivers/zfcp/*.*.*; do
|
||||
[ -d $HOST_PATH/host[0-9]* ] && continue # is/was online
|
||||
HOST_LIST="$HOST_LIST
|
||||
$(readlink -e $HOST_PATH)/-"
|
||||
done
|
||||
fi
|
||||
|
||||
for HOST_PATH in $HOST_LIST; do
|
||||
@@ -177,14 +196,25 @@ $(ls -dX $SYSFS/devices/css[0-9]*/defunct/[0-9]*/host[0-9]* 2>/dev/null)"
|
||||
echo $ADAPTER $SCSI_HOST$HOSTMARKER
|
||||
else
|
||||
echo $ADAPTER_PATH$HOSTMARKER
|
||||
$FC_CLASS && echo "$SYSFS/class/fc_host/$SCSI_HOST"
|
||||
echo "$SYSFS/class/scsi_host/$SCSI_HOST"
|
||||
if [ "$SCSI_HOST" != "-" ]; then
|
||||
$FC_CLASS && echo "$SYSFS/class/fc_host/$SCSI_HOST"
|
||||
echo "$SYSFS/class/scsi_host/$SCSI_HOST"
|
||||
else
|
||||
echo "-"
|
||||
echo "-"
|
||||
fi
|
||||
fi
|
||||
|
||||
if $SHOW_ATTRIBUTES; then
|
||||
echo 'Bus = "ccw"'
|
||||
show_attributes $ADAPTER_PATH
|
||||
|
||||
if [ "$SCSI_HOST" = "-" ]; then
|
||||
# skip output of non-existent fc_host & scsi_host
|
||||
echo
|
||||
continue
|
||||
fi
|
||||
|
||||
if $FC_CLASS; then
|
||||
echo 'Class = "fc_host"'
|
||||
show_attributes \
|
||||
|
||||
@@ -51,6 +51,7 @@ Since a long time, without option "-e", lszfcp has
|
||||
.I
|
||||
not
|
||||
enumerated:
|
||||
hosts that have never been online (since last bind to zfcp device driver),
|
||||
hosts that are defunct (CHPID configured off, or z/VM detach),
|
||||
ports with fc_rport port_state unequal to "Online" (such as fibres pulled).
|
||||
|
||||
@@ -63,7 +64,8 @@ Show all attributes of the specified objects.
|
||||
List zfcp units and SCSI devices.
|
||||
.TP
|
||||
.B -H, --hosts
|
||||
List zfcp adapters and fc-hosts (default). Information is given only
|
||||
List zfcp adapters, fc-hosts, and scsi-hosts (default).
|
||||
Without option "-e", information is given only
|
||||
for adapters that are online (registered at the SCSI stack).
|
||||
.TP
|
||||
.B -P, --ports
|
||||
|
||||
Reference in New Issue
Block a user