Files
s390-tools/zconf/lstape.8
T
Steffen Maier 80e0c41b89 lstape: fix output without SCSI generic (sg)
The default bash setting have nullglob disabled so if
$SCSI_DEV/scsi_generic*
aka
/sys/bus/scsi/devices/*:*:*:*/scsi_generic*
does not match anything, it leaves the glob pattern unmodified and
SG_DEV=$(basename $SG_DEV/*)
results in the literal:
*
If $SG_INQ exists, it invoked sg_inq with more than the one allowed
positional argument for a SCSI generic device node:
sg_inq /dev/*
Causing error messages and the usage of sg_inq to land in $TAPE_SERIAL.

To not have to rely on the nullglob setting, explicitly check for the
existence of $SCSI_DEV/scsi_generic before evaluating
SG_DEV=$(basename $SG_DEV/*).

Also handle availability of sg_inq but absence of scsi_generic
individually to provide the user with a hint if only sg is missing.

Suggested-by: Eric Farman <farman@linux.vnet.ibm.com>
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
Reviewed-by: Jens Remus <jremus@linux.ibm.com>
Cc: Eric Farman <farman@linux.vnet.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2018-09-04 14:09:24 +02:00

98 lines
3.0 KiB
Plaintext

.\" Copyright 2017, 2018 IBM Corp.
.\" s390-tools is free software; you can redistribute it and/or modify
.\" it under the terms of the MIT license. See LICENSE for details.
.\"
.TH LSTAPE 8 "Jun 2018" "s390-tools"
.SH NAME
lstape \- list tape devices.
.SH SYNOPSIS
.TP 16
.B lstape
.RB [ -h | --help]
.RB [ --scsi-only | --ccw-only ]
.RB [ -v | --version ]
.RB [ -V | --verbose ]
.br
.RB [ --online | --offline ]
.RB [ -s ]
.br
.RB [ -t
.IR <device-type> [, <device-type> ] "" ...]
.SH DESCRIPTION
The lstape command lists all available tape devices on the current host. For
channel attached tape devices this output is the same as the contents of
/proc/tapedevices (which is obsolete) but also includes offline devices. By
default all tape devices are displayed.
Since SCSI tape devices are accessed differently to channel attached tape
devices they are only visible if they are known to the SCSI layer. There
are at least two possible drivers that can claim a SCSI tape device and the
lstape command tries to find out which one this is. For the generic tape
and changer driver the device names start with "st" or "sch", while for the
IBM tape driver this would be "IBMtape" or "IBMchanger". If "N/A" is shown,
the correct driver could not be obtained.
The serial number of a SCSI tape can be displayed with the --verbose option. If
there is no sg_inq command available "NO/INQ" is shown as the serial number
of the tape.
If no SCSI generic (sg) kernel support is available, "NO/SG" is shown
as the serial number of the tape and "N/A" for the "Generic" column.
The lstape command without the --ccw-only option causes extra SAN traffic
for each SCSI tape or changer device by invoking the sg_inq command.
.SH OPTIONS
.TP 8
\fB-h\fR or \fB--help\fR
Print help text.
.TP 8
\fB-v\fR or \fB--version\fR
Print the version of the s390-tools package and the command.
.TP
\fB-V\fB or \fB--verbose\fR
Adds additional information that does not fit into a single line of output.
This is currently only used for SCSI devices.
.TP
.BR --scsi-only | --ccw-only
Limit output to either SCSI or channel attached tape devices. The output without
SCSI devices is the same as it was with previous versions of this command.
.TP
.BR -s | --shortid
Using this option will list only tape devices that are in channel subsystem 0,
with subchannel set 0. All other devices will be suppressed and the leading
"0.0." for bus IDs of the remaining devices will be removed.
Since this is specific to CCW devices this option has no effect on the output
of SCSI tape devices.
.TP
.BR --online | --offline
Limit output to either online or offline devices. This filter has no effect
on the output of SCSI devices.
.TP
.BR -t | --type " \fI<device-type>\fR"
Limit output to given device types (currently only applies to channel attached
tape devices).
.TP
\fB<device-type>\fR =
Device type of devices that should be displayed (e.g. 3490).
.SH EXAMPLES
\fBlstape\fR
.RS
List all tape devices that are available
.RE
\fBlstape --ccw-only -t 3490 --online\fR
.RS
Show all 3490 CCW devices that are online.
.RE