From e84287e76e354f4091444f7e1b78080329c67134 Mon Sep 17 00:00:00 2001 From: Steffen Maier Date: Tue, 19 Feb 2019 18:19:20 +0100 Subject: [PATCH] lszfcp: attribute details for: css, zfcp_port, zfcp_unit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Consistency with "lszfcp -Ha" which includes zfcp_adapter as class=ccw. Attribute details are especially useful to show the driver-internal status. For FCP devices (hosts), "css" shows subchannel details including CHPID. Abbreviated examples: $ lszfcp -PVeam -b 0.0.50c0 -p 0x500507680b2481fa - (NoMoreZfcpPort:0.0.50c0/0x500507680b2481fa) /sys/class/fc_remote_ports/rport-6:0-2 NotOnline Class = "fc_remote_ports" dev_loss_tmo = "60" fast_io_fail_tmo = "off" maxframe_size = "2048 bytes" node_name = "0x500507680b0081fa" port_id = "0x242200" port_name = "0x500507680b2481fa" port_state = "Blocked" roles = "FCP Target" scsi_target_id = "2" supported_classes = "Class 2, Class 3" $ lszfcp -HPDeam 0.0.1900 host0 Bus = "css" chpids = "60 00 00 00 00 00 00 00" modalias = "css:t0" pimpampom = "80 80 ff" type = "0" uevent = "DRIVER=io_subchannel" vpm = "80" Bus = "ccw" availability = "good" ... failed = "0" in_recovery = "0" online = "1" status = "0x5400040b" ... Class = "fc_host" ... port_state = "Online" port_type = "NPIV VPORT" ... Class = "scsi_host" ... state = "running" ... 0.0.1940 host8 offline Bus = "css" chpids = "61 00 00 00 00 00 00 00" modalias = "css:t0" pimpampom = "80 80 ff" type = "0" uevent = "DRIVER=io_subchannel" vpm = "80" Bus = "ccw" availability = "good" ... failed = "0" in_recovery = "0" online = "0" status = "0x00000401" ... Class = "fc_host" ... port_state = "Unknown" port_type = "NPIV VPORT" ... Class = "scsi_host" ... state = "running" ... 0.0.5000 host1 offline Bus = "css" chpids = "67 00 00 00 00 00 00 00" modalias = "css:t0" pimpampom = "80 80 ff" type = "0" uevent = "DRIVER=io_subchannel" vpm = "80" Bus = "ccw" availability = "good" ... failed = "0" in_recovery = "0" online = "0" status = "0x00000401" uevent = "DRIVER=zfcp" ... Class = "fc_host" ... port_state = "Unknown" port_type = "NPort (fabric via point-to-point)" ... Class = "scsi_host" ... state = "running" ... 0.0.3c40 host7 defunct Bus = "css" defunct Bus = "ccw" availability = "no device" ... failed = "0" in_recovery = "0" online = "1" status = "0x00000401" ... Class = "fc_host" ... port_state = "Unknown" port_type = "NPIV VPORT" ... Class = "scsi_host" ... state = "running" ... 0.0.1880 - offline Bus = "css" chpids = "5a 00 00 00 00 00 00 00" modalias = "css:t0" pimpampom = "80 80 ff" type = "0" uevent = "DRIVER=io_subchannel" vpm = "00" Bus = "ccw" availability = "good" cmb_enable = "0" cutype = "1731/03" devtype = "1732/03" modalias = "ccw:t1731m03dt1732dm03" online = "0" uevent = "DRIVER=zfcp" 0.0.1900/0x500507630708c5e3 rport-0:0-0 Class = "zfcp_port" access_denied = "0" failed = "0" in_recovery = "0" status = "0x54000001" Class = "fc_remote_ports" dev_loss_tmo = "2147483647" fast_io_fail_tmo = "5" maxframe_size = "2112 bytes" node_name = "0x5005076307ffc5e3" port_id = "0x675c00" port_name = "0x500507630708c5e3" port_state = "Online" roles = "FCP Target" scsi_target_id = "0" supported_classes = "Class 2, Class 3" 0.0.5000/0x500507680b2381fb rport-1:0-0 NotOnline Class = "zfcp_port" access_denied = "0" failed = "0" in_recovery = "0" status = "0x00000001" Class = "fc_remote_ports" dev_loss_tmo = "2147483647" fast_io_fail_tmo = "5" maxframe_size = "2048 bytes" node_name = "0x500507680b0081fb" port_id = "0x24e200" port_name = "0x500507680b2381fb" port_state = "Blocked" roles = "FCP Target" scsi_target_id = "0" supported_classes = "Class 2, Class 3" 0.0.5040/0x500507680b2281fa rport-2:0-0 Class = "zfcp_port" access_denied = "0" failed = "0" in_recovery = "0" status = "0x54000001" Class = "fc_remote_ports" dev_loss_tmo = "2147483647" fast_io_fail_tmo = "5" maxframe_size = "2048 bytes" node_name = "0x500507680b0081fa" port_id = "0x24a300" port_name = "0x500507680b2281fa" port_state = "Online" roles = "FCP Target" scsi_target_id = "0" supported_classes = "Class 2, Class 3" 0.0.1940/0x500507630718c5e3 rport-8:0-0 NotOnline Class = "zfcp_port" access_denied = "0" failed = "0" in_recovery = "0" status = "0x00000001" Class = "fc_remote_ports" dev_loss_tmo = "2147483647" fast_io_fail_tmo = "5" maxframe_size = "2112 bytes" node_name = "0x5005076307ffc5e3" port_id = "0x675e00" port_name = "0x500507630718c5e3" port_state = "Blocked" roles = "FCP Target" scsi_target_id = "0" supported_classes = "Class 2, Class 3" 0.0.1900/0x500507630708c5e3/0x4000408600000000 0:0:0:1082540032 auto Class = "scsi_device" ... state = "running" ... zfcp_access_denied = "0" zfcp_failed = "0" zfcp_in_recovery = "0" zfcp_status = "0x54000000" 0.0.1940/0x500507630718c5e3/0x4000408600000000 8:0:0:1082540032 auto NotRunning Class = "scsi_device" ... state = "transport-offline" ... zfcp_access_denied = "0" zfcp_failed = "0" zfcp_in_recovery = "0" zfcp_status = "0x00000000" 0.0.5000/0x500507680b2381fb/0x0256000000000000 1:0:0:598 NotRunning Class = "zfcp_unit" access_denied = "0" access_readonly = "0" access_shared = "0" failed = "0" in_recovery = "0" status = "0x00000000" Class = "scsi_device" ... state = "transport-offline" ... zfcp_access_denied = "0" zfcp_failed = "0" zfcp_in_recovery = "0" zfcp_status = "0x00000000" 0.0.5040/0x500507680b2281fa/0x0256000000000000 2:0:0:598 Class = "zfcp_unit" access_denied = "0" access_readonly = "0" access_shared = "0" failed = "0" in_recovery = "0" status = "0x54000000" Class = "scsi_device" ... state = "running" ... zfcp_access_denied = "0" zfcp_failed = "0" zfcp_in_recovery = "0" zfcp_status = "0x54000000" Signed-off-by: Steffen Maier Reviewed-by: Jens Remus Signed-off-by: Jan Höppner --- zconf/lszfcp | 35 ++++++++++++++++++++++++++++++++--- zconf/lszfcp.8 | 13 ++++++++++--- 2 files changed, 42 insertions(+), 6 deletions(-) diff --git a/zconf/lszfcp b/zconf/lszfcp index a8700653..4b5da9f7 100755 --- a/zconf/lszfcp +++ b/zconf/lszfcp @@ -18,6 +18,7 @@ SHOW_HOSTS=0 SHOW_PORTS=0 SHOW_DEVICES=0 SHOW_ATTRIBUTES=false +SHOW_MORE_ATTRS=0 SHOW_EXTENDED=false unset PAR_BUSID PAR_WWPN PAR_LUN @@ -111,7 +112,9 @@ OPTIONS: -b, --busid=BUSID select specific busid -p, --wwpn=WWPN select specific port name -l, --lun=LUN select specific LUN - -a, --attributes show all attributes + -a, --attributes show attributes + -m, --moreattrs show more attributes + (host: css; port: zfcp_port; SCSI device: zfcp_unit) -V, --verbose show sysfs paths of associated class and bus devices -e, --extended extended output format @@ -206,6 +209,15 @@ $(readlink -e $HOST_PATH)/-" fi if $SHOW_ATTRIBUTES; then + if [ $SHOW_MORE_ATTRS -ge 1 ]; then + echo 'Bus = "css"' + if [ "$DEFUNCT" = "defunct" ]; then + printf " %-19s\n" "defunct" + else + show_attributes ${ADAPTER_PATH%/*} + fi + fi + echo 'Bus = "ccw"' show_attributes $ADAPTER_PATH @@ -304,6 +316,15 @@ show_ports() fi if $SHOW_ATTRIBUTES; then + if [ $SHOW_MORE_ATTRS -ge 1 ] \ + && [ "$ADAPTER_PORT_PATH" != "-" ] \ + && [ -d $ADAPTER_PORT_PATH ]; + then + # fc_rport can exist without zfcp_port + # (e.g. after port_remove) + echo 'Class = "zfcp_port"' + show_attributes "$ADAPTER_PORT_PATH" + fi echo 'Class = "fc_remote_ports"' show_attributes "$FC_PORT_PATH" echo @@ -392,6 +413,13 @@ show_devices() fi fi + if $SHOW_ATTRIBUTES && [ $SHOW_MORE_ATTRS -ge 1 ]; then + # auto scan LUNs not necessarily have a zfcp_unit + if [ -d $ZFCP_UNIT_PATH ]; then + echo 'Class = "zfcp_unit"' + show_attributes "$ZFCP_UNIT_PATH" + fi + fi if $SHOW_ATTRIBUTES; then echo 'Class = "scsi_device"' show_attributes "$SCSI_DEVICE_PATH" @@ -403,8 +431,8 @@ show_devices() ############################################################################## -ARGS=`getopt --options ahvHPDVb:p:l:s:e --longoptions \ -attributes,help,version,hosts,ports,devices,verbose,busid:,wwpn:,lun:,sysfs:,extended \ +ARGS=`getopt --options ahvHPDVb:p:l:s:em --longoptions \ +attributes,help,version,hosts,ports,devices,verbose,busid:,wwpn:,lun:,sysfs:,extended,moreattrs \ -n "$SCRIPTNAME" -- "$@"` if [ $? -ne 0 ]; then @@ -418,6 +446,7 @@ eval set -- "$ARGS" for ARG; do case "$ARG" in -a|--attributes) SHOW_ATTRIBUTES=true; shift 1;; + -m|--moreattrs) ((SHOW_MORE_ATTRS++)); shift 1;; -e|--extended) SHOW_EXTENDED=true; shift 1;; -b|--busid) PAR_BUSID=$2; shift 2;; -h|--help) print_help; exit 0;; diff --git a/zconf/lszfcp.8 b/zconf/lszfcp.8 index 28aea1f5..0b91ed07 100644 --- a/zconf/lszfcp.8 +++ b/zconf/lszfcp.8 @@ -8,7 +8,7 @@ lszfcp \- list information about zfcp adapters, ports, and units .SH SYNOPSIS .B lszfcp -.RB [ \-hvVaHDPe ] +.RB [ \-hvVaHDPem ] .RB [ \-b .IR busid ] .RB [ \-l @@ -40,9 +40,12 @@ listed object. If a SCSI device has an associated block device (disk) and SCSI generic (sg) device, show their sysfs paths in a 3rd line. -Option "-a" additionally shows all attributes of interest found in +Option "-a" additionally shows attributes of interest found in sysfs for the listed object. +Option "-m" together with option "-a" shows sysfs attributes if available for: +host: css (subchannel); port: zfcp_port; lun: zfcp_unit. + Option "-e" enables an extended output format. It enumerates all hosts/ports/luns independent of their state. It also produces some improved error messages. @@ -58,7 +61,11 @@ ports with fc_rport port_state unequal to "Online" (such as fibres pulled). .SH OPTIONS .TP .B -a, --attributes -Show all attributes of the specified objects. +Show the most interesting attributes of the specified objects. +.TP +.B -m, --moreattrs +Show more attributes of the specified objects. +Host: css (subchannel). Port: zfcp_port. Lun: zfcp_unit. .TP .B -D, --devices List zfcp units and SCSI devices.