diff --git a/zconf/lszfcp b/zconf/lszfcp index f8dacca8..0322db89 100755 --- a/zconf/lszfcp +++ b/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 \ diff --git a/zconf/lszfcp.8 b/zconf/lszfcp.8 index a5653187..28aea1f5 100644 --- a/zconf/lszfcp.8 +++ b/zconf/lszfcp.8 @@ -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