Accepting request 635597 from Base:System

- Added the following patch for bsc#1094354
  * customize-zdev-root-update-script.patch
- Modified ctc_configure to not pass a "protcol=" parameter when
  configuring LCS devices. (bsc#1096520)
- Added the following patches for bsc#1098069
  * s390-tools-sles15-dbginfo-add-data-for-ps-cpprot.patch
  * s390-tools-sles15-mon_procd-fix-parsing-of-proc-pid-stat.patch
  * s390-tools-sles15-1-lstape-fix-output-with-SCSI-lin_tape-and-multiple-pa.patch
  * s390-tools-sles15-2-lstape-fix-to-prefer-sysfs-to-find-lin_tape-device-n.patch
  * s390-tools-sles15-3-lstape-fix-output-without-SCSI-generic-sg.patch
  * s390-tools-sles15-4-lsluns-fix-to-prevent-error-messages-if-there-are-no.patch
  * s390-tools-sles15-5-lstape-fix-to-prevent-error-messages-if-there-are-no.patch
  * s390-tools-sles15-6-lstape-fix-description-of-type-and-devbusid-filter-f.patch
  * s390-tools-sles15-7-lstape-fix-SCSI-output-description-in-man-page.patch
  * s390-tools-sles15-8-lstape-fix-SCSI-HBA-CCW-device-bus-ID-e.g.-for-virti.patch
- dasd_reload: Fixed several syntax errors. Changed the script to
  ensure that the DASD volume are actually activated in device
  number order. If an old 51-dasd-<ccw>.rules file is found,
  rename it to obsolete-51-dasd-<ccw>.rules, and use chzdev to
  generate a new rules file. (bsc#1103407)
- dasd_reload: Check for 41-dasd-<type>-<ccw>.rules in addition
  to the original 51-dasd-<ccw>.rules (bsc#1103407)
- Removed s390 from the ExclusiveArch parameter (bsc#1102906)

OBS-URL: https://build.opensuse.org/request/show/635597
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/s390-tools?expand=0&rev=20
This commit is contained in:
Yuchen Lin 2018-09-20 09:37:11 +00:00 committed by Git OBS Bridge
commit 352be82c0a
15 changed files with 1614 additions and 48 deletions

View File

@ -88,11 +88,6 @@ if [ -z "${CTC_READ_CHAN}" ] || [ -z "${CTC_WRITE_CHAN}" ] || [ -z "${ON_OFF}" ]
exit 1
fi
if [ -z "${CTC_MODE}" ]; then
PARM_LIST="${PARM_LIST} protocol=0"
else PARM_LIST="${PARM_LIST} protocol=${CTC_MODE}"
fi
if [ -f /sys/bus/ccw/devices/${CTC_READ_CHAN}/cutype ]; then
read CU_TYPE < /sys/bus/ccw/devices/${CTC_READ_CHAN}/cutype
else mesg "Psuedo file/sys/bus/ccw/devices/${CTC_READ_CHAN}/cutype doesn't exist."
@ -100,9 +95,14 @@ else mesg "Psuedo file/sys/bus/ccw/devices/${CTC_READ_CHAN}/cutype doesn't exist
exit 1
fi
PARM_LIST=""
if [ "${CU_TYPE}" == "3088/01" ] || [ "${CU_TYPE}" == "3088/60" ]; then
DEV_TYPE="lcs"
else DEV_TYPE="ctc"
if [ -z "${CTC_MODE}" ]; then
PARM_LIST="${PARM_LIST} protocol=0"
else PARM_LIST="${PARM_LIST} protocol=${CTC_MODE}"
fi
fi
if [ "${ON_OFF}" == 0 ]; then

View File

@ -0,0 +1,13 @@
--- s390-tools-2.1.0/zdev/src/zdev-root-update.dracut 2017-09-25 08:15:15.000000000 -0400
+++ s390-tools-2.1.0/zdev/src/zdev-root-update.dracut 2018-08-23 21:33:40.847755927 -0400
@@ -20,10 +20,4 @@
exit 1
}
-echo "Installing IPL record"
-zipl --noninteractive || {
- echo "${TOOLNAME}: Error: Could not install IPL record" >&2
- exit 1
-}
-
exit 0

View File

@ -50,16 +50,16 @@ fi
dasd_alias=
let EXITRC=0
for dev in /sys/bus/ccw/devices/*; do
if [ -f $dev/use_diag ]; then
read _online < $dev/online
read _alias < $dev/alias
if [ -f ${dev}/use_diag ]; then
read _online < ${dev}/online
read _alias < ${dev}/alias
if [ "$_online" -eq 1 -a "$_alias" -eq 1 ]; then
echo "setting DASD HyperPAV alias $(basename $dev) offline"
echo "0" > $dev/online
read _online < $dev/online
dasd_alias="$dasd_alias $(basename $dev)"
echo "setting DASD HyperPAV alias $(basename ${dev}) offline"
echo "0" > ${dev}/online
read _online < ${dev}/online
dasd_alias="${dasd_alias} $(basename ${dev})"
if [ "$_online" -eq 1 ]; then
echo "failure on setting DASD HyperPAV alias $(basename $dev) offline !"
echo "failure on setting DASD HyperPAV alias $(basename ${dev}) offline !"
let EXITRC=4
fi
fi
@ -71,16 +71,16 @@ done
#
dasd_base=
for dev in /sys/bus/ccw/devices/*; do
if [ -f $dev/use_diag ]; then
read _online < $dev/online
read _alias < $dev/alias
if [ -f ${dev}/use_diag ]; then
read _online < ${dev}/online
read _alias < ${dev}/alias
if [ "$_online" -eq 1 -a "$_alias" -eq 0 ]; then
echo "setting DASD $(basename $dev) offline"
echo "0" > $dev/online
read _online < $dev/online
dasd_base="$dasd_base $(basename $dev)"
echo "setting DASD $(basename ${dev}) offline"
echo "0" > ${dev}/online
read _online < ${dev}/online
dasd_base="${dasd_base} $(basename ${dev})"
if [ "$_online" -eq 1 ]; then
echo "failure on setting DASD $(basename $dev) offline !"
echo "failure on setting DASD $(basename ${dev}) offline !"
let EXITRC=4
fi
fi
@ -91,46 +91,65 @@ udevadm settle
module_list=
module_test_list="dasd_diag_mod dasd_eckd_mod dasd_fba_mod dasd_mod"
for module in $module_test_list; do
if grep -q "$module" /proc/modules; then
module_list="$module $module_list"
: Unloading $module
/sbin/rmmod $module
for module in ${module_test_list}; do
if grep -q "${module}" /proc/modules; then
module_list="${module} ${module_list}"
: Unloading ${module}
/sbin/rmmod ${module}
fi
done
udevadm settle
sleep 2
if [ -d /etc/udev/rules.d ]; then
cd /etc/udev/rules.d
#
# Re-activating "normal" DASD and HyperPAV base devices
#
for dasd in $dasd_base; do
file="51-dasd-${dasd}.rules"
if [ -f "$file" ] ; then
echo Activating $dasd
if grep -q use_diag $file ; then
DASD_USE_DIAG=1
else
DASD_USE_DIAG=0
# We need to move all the DASD udev rules out from /etc/udev/rules.d
# because if we don't, then when the first DASD volume gets brought
# back online, they are all brought back online, in a non-deterministic
# order, not the numeric order we expect.
#
mv -i 41-dasd-*.rules 51-dasd-*.rules /tmp
cd /tmp
for dasd in ${dasd_base}; do
for file in 41-dasd-*-${dasd}.rules 51-dasd-${dasd}.rules; do
[ -f "${file}" ] || continue
#
# Special handling is needed for old udev rules that start with 51-
# since the chzdev command won't look for that name
#
prefix="$(echo ${file} | cut -f1 -d-)"
if [ "${prefix}" == "51" ]; then
if [ -h /sys/bus/ccw/drivers/dasd-eckd/${dasd} ]; then
mv -i ${file} 41-dasd-eckd-${dasd}.rules
elif [ -h /sys/bus/ccw/drivers/dasd-fba/${dasd} ]; then
mv -i ${file} 41-dasd-fba-${dasd}.rules
else echo "DASD volume ${dasd} is neither an ECKD or FBA device."
let EXITRC=4
fi
fi
/sbin/dasd_configure $dasd 1 $DASD_USE_DIAG
fi
echo Activating ${dasd}
mv -i "${file}" /etc/udev/rules.d/
/sbin/chzdev dasd --apply --configured -q --no-root-update ${dasd}
lsdasd
break
done
done
#
# Re-activating HyperPAV alias devices
#
for dasd in $dasd_alias; do
file="51-dasd-${dasd}.rules"
if [ -f "$file" ] ; then
echo Activating $dasd
if grep -q use_diag $file ; then
DASD_USE_DIAG=1
else
DASD_USE_DIAG=0
fi
/sbin/dasd_configure $dasd 1 $DASD_USE_DIAG
fi
for dasd in ${dasd_alias}; do
for file in 41-dasd-*-${dasd}.rules 51-dasd-${dasd}.rules; do
[ -f "${file}" ] || continue
echo Activating ${dasd}
mv -i "${file}" /etc/udev/rules.d/
/sbin/chzdev dasd --apply --configured -q --no-root-update ${dasd}
break
done
done
fi

View File

@ -0,0 +1,181 @@
Subject: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
From: Steffen Maier <maier@linux.ibm.com>
Description: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
Symptom: lstape shows unexpected additional Device suffix numbers in
excess output columns for each additional path of the same
tape/changer driven by the IBM lin_tape device driver
(independent of actual path failover enablement in lin_tape).
It also shows a wrong number of found devices in the header
(without --scsi-only).
lstape prints error about "Unexpected extra argument:" and the
usage for "sg_inq" along with wrong tabular output.
lsluns prints ENOENT error text for "cat" on SCSI device sysfs
attributes hba_id, wwpn, and fcp_lun.
lstape with --verbose option prints ENOENT error text for
"cat" on SCSI device sysfs attributes hba_id and wwpn.
lstape man page: Description of --type and <devbusid> filter
for channel tapes is incomplete. SCSI output description is
incomplete.
lstape shows "N/A" instead of the HBA device bus-ID with
virtio-scsi-ccw.
Problem: s390-tools-1.8.0 before the first upstream commit b627b8d8e1ab
("Initial s390-tools-2.0.0 import") introduced SCSI
tape/changer output for lstape. It used the SCSI device serial
number as lookup key to find a match in IBM lin_tape device
driver proc-fs output for a given SCSI device name. Multiple
paths to the same tape/changer have the same serial number.
Multiple matches cause excess arguments to printf. Explaining
the resulting output, the bash man page says: "The format is
reused as necessary to consume all of the arguments." This
also causes a wrong number of found devices.
The default bash settings 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.
lsluns iterates SCSI generic devices and unconditionally
reads zfcp-specific SCSI device sysfs attributes hba_id, wwpn,
and fcp_lun.
lstape --verbose unconditionally reads zfcp-specific SCSI
device sysfs attributes hba_id and wwpn.
<devbusid> filter missing from synopsis. <device-type> example
at wrong place with <devbusid> filter. <devbusid> filter
option description is a duplicate of <device-type> filter
option description. SCSI output description misses fields.
Lstape only used the zfcp-specific sysfs attribute hba_id.
Solution: Prefer sysfs to find lin_tape device name for SCSI device.
Fallback: The lin_tape proc-fs output format has changed over
the years. The HBA device driver string can contain whitespace
(e.g. "Virtio SCSI HBA") and breaks the field numbers with
tokenized parsing. Grep for the SCSI device name as word (to
skip names with same substring, such as 0:0:1:1 also matching
0:0:1:10) and cut the first field 'Number' (lin_tape device
name suffix). If there is no SCSI column at all [lin_tape
before v2.2.0] (and no SCSI LLDD or other column with a name
accidentally matching an existing SCSI device name), we get no
match and better bail out with the initialized "N/A" for the
lstape column "Device".
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.
Simply skip non-zfcp SCSI devices, such as iSCSI or
virtio-scsi-ccw, to not erroneously access absent attributes.
Assume "N/A" for HBA and WWPN of non-zfcp SCSI devices, such
as iSCSI or virtio-scsi-ccw, to not erroneously access absent
zfcp-specific sysfs attributes.
Add <devbusid> filter to synopsis. Move <device-type> example
to <device-type> option. Replace <devbusid> filter option
description. Move existing SCSI output description to a new
subsection and add description of missing fields.
Also search sysfs for an ancestor with subsystem ccw.
Reproduction: Attach more than one path to the same SCSI tape or changer and
load the IBM lin_tape device driver.
Unload sg kernel module.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
man lstape
Attach SCSI tape or changer with virtio-scsi-ccw to a KVM
guest and run "lstape --verbose".
Upstream-ID: -
Problem-ID: 170633
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
zconf/lstape | 11 ++++-------
zconf/lstape.8 | 7 ++-----
2 files changed, 6 insertions(+), 12 deletions(-)
--- a/zconf/lstape
+++ b/zconf/lstape
@@ -2,7 +2,7 @@
#
# lstape - Tool to show information about tape devices
#
-# Copyright IBM Corp. 2003, 2017
+# Copyright IBM Corp. 2003, 2018
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
@@ -55,7 +55,7 @@ function PrintVersion()
{
cat <<-EOD
$CMD: version %S390_TOOLS_VERSION%
- Copyright IBM Corp. 2003, 2017
+ Copyright IBM Corp. 2003, 2018
EOD
}
@@ -292,16 +292,13 @@ function SysfsCreateListSCSI()
TAPE_DEV=$CHG_IDX
fi
elif [ -r /proc/scsi/$DEV_NAME ]; then
- if [ "$TAPE_SERIAL" != "NO/INQ" ]; then
IBM_IDX=$(
- awk '$3 == "'$TAPE_SERIAL'"{
- print $1
- }' /proc/scsi/$DEV_NAME
+ grep -wF "$SCSI_ID" /proc/scsi/$DEV_NAME |
+ cut -d ' ' -f 1
)
if [ "$IBM_IDX" != "" ]; then
TAPE_DEV=$DEV_NAME$IBM_IDX
fi
- fi
fi
printf "$SCSIFORMAT" \
--- a/zconf/lstape.8
+++ b/zconf/lstape.8
@@ -1,8 +1,8 @@
-.\" Copyright 2017 IBM Corp.
+.\" 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 "Jul 2007" "s390-tools"
+.TH LSTAPE 8 "Jun 2018" "s390-tools"
.SH NAME
lstape \- list tape devices.
@@ -34,9 +34,6 @@ lstape command tries to find out which o
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.
-This happens for example if there is no sg_inq command installed which is
-required to read the drive's serial number which in turn is used to find out
-the device number of the IBM tape driver.
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 tape's serial.

View File

@ -0,0 +1,144 @@
Subject: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
From: Steffen Maier <maier@linux.ibm.com>
Description: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
Symptom: lstape shows unexpected additional Device suffix numbers in
excess output columns for each additional path of the same
tape/changer driven by the IBM lin_tape device driver
(independent of actual path failover enablement in lin_tape).
It also shows a wrong number of found devices in the header
(without --scsi-only).
lstape prints error about "Unexpected extra argument:" and the
usage for "sg_inq" along with wrong tabular output.
lsluns prints ENOENT error text for "cat" on SCSI device sysfs
attributes hba_id, wwpn, and fcp_lun.
lstape with --verbose option prints ENOENT error text for
"cat" on SCSI device sysfs attributes hba_id and wwpn.
lstape man page: Description of --type and <devbusid> filter
for channel tapes is incomplete. SCSI output description is
incomplete.
lstape shows "N/A" instead of the HBA device bus-ID with
virtio-scsi-ccw.
Problem: s390-tools-1.8.0 before the first upstream commit b627b8d8e1ab
("Initial s390-tools-2.0.0 import") introduced SCSI
tape/changer output for lstape. It used the SCSI device serial
number as lookup key to find a match in IBM lin_tape device
driver proc-fs output for a given SCSI device name. Multiple
paths to the same tape/changer have the same serial number.
Multiple matches cause excess arguments to printf. Explaining
the resulting output, the bash man page says: "The format is
reused as necessary to consume all of the arguments." This
also causes a wrong number of found devices.
The default bash settings 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.
lsluns iterates SCSI generic devices and unconditionally
reads zfcp-specific SCSI device sysfs attributes hba_id, wwpn,
and fcp_lun.
lstape --verbose unconditionally reads zfcp-specific SCSI
device sysfs attributes hba_id and wwpn.
<devbusid> filter missing from synopsis. <device-type> example
at wrong place with <devbusid> filter. <devbusid> filter
option description is a duplicate of <device-type> filter
option description. SCSI output description misses fields.
Lstape only used the zfcp-specific sysfs attribute hba_id.
Solution: Prefer sysfs to find lin_tape device name for SCSI device.
Fallback: The lin_tape proc-fs output format has changed over
the years. The HBA device driver string can contain whitespace
(e.g. "Virtio SCSI HBA") and breaks the field numbers with
tokenized parsing. Grep for the SCSI device name as word (to
skip names with same substring, such as 0:0:1:1 also matching
0:0:1:10) and cut the first field 'Number' (lin_tape device
name suffix). If there is no SCSI column at all [lin_tape
before v2.2.0] (and no SCSI LLDD or other column with a name
accidentally matching an existing SCSI device name), we get no
match and better bail out with the initialized "N/A" for the
lstape column "Device".
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.
Simply skip non-zfcp SCSI devices, such as iSCSI or
virtio-scsi-ccw, to not erroneously access absent attributes.
Assume "N/A" for HBA and WWPN of non-zfcp SCSI devices, such
as iSCSI or virtio-scsi-ccw, to not erroneously access absent
zfcp-specific sysfs attributes.
Add <devbusid> filter to synopsis. Move <device-type> example
to <device-type> option. Replace <devbusid> filter option
description. Move existing SCSI output description to a new
subsection and add description of missing fields.
Also search sysfs for an ancestor with subsystem ccw.
Reproduction: Attach more than one path to the same SCSI tape or changer and
load the IBM lin_tape device driver.
Unload sg kernel module.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
man lstape
Attach SCSI tape or changer with virtio-scsi-ccw to a KVM
guest and run "lstape --verbose".
Upstream-ID: -
Problem-ID: 170633
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
zconf/lstape | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
--- a/zconf/lstape
+++ b/zconf/lstape
@@ -291,6 +291,23 @@ function SysfsCreateListSCSI()
if [ "$CHG_IDX" != "" ]; then
TAPE_DEV=$CHG_IDX
fi
+ elif [ "$(echo "$SCSI_LIST"|grep lin_tape)" != "" ]; then
+ # bash glob sorts so IBMtape0 comes before IBMtape0n
+ local IBM_PATH=$(
+ ls -1d $SCSI_DEV/lin_tape/$DEV_NAME[0-9]* |
+ head -n 1)
+ if [ -d "$IBM_PATH" ]; then
+ IBM_IDX=${IBM_PATH##*/}
+ else
+ # deprecated sysfs layout
+ IBM_IDX=$(
+ echo "$SCSI_LIST" |
+ awk -F: '/lin_tape\:'"$DEV_NAME"'[0-9]+$/{print $NF}'
+ )
+ fi
+ if [ "$IBM_IDX" != "" ]; then
+ TAPE_DEV=$IBM_IDX
+ fi
elif [ -r /proc/scsi/$DEV_NAME ]; then
IBM_IDX=$(
grep -wF "$SCSI_ID" /proc/scsi/$DEV_NAME |

View File

@ -0,0 +1,167 @@
Subject: [PATCH] [BZ 170633] lstape, lsluns: handle non-zfcp; lin_tape multiple paths
From: Steffen Maier <maier@linux.ibm.com>
Description: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
Symptom: lstape shows unexpected additional Device suffix numbers in
excess output columns for each additional path of the same
tape/changer driven by the IBM lin_tape device driver
(independent of actual path failover enablement in lin_tape).
It also shows a wrong number of found devices in the header
(without --scsi-only).
lstape prints error about "Unexpected extra argument:" and the
usage for "sg_inq" along with wrong tabular output.
lsluns prints ENOENT error text for "cat" on SCSI device sysfs
attributes hba_id, wwpn, and fcp_lun.
lstape with --verbose option prints ENOENT error text for
"cat" on SCSI device sysfs attributes hba_id and wwpn.
lstape man page: Description of --type and <devbusid> filter
for channel tapes is incomplete. SCSI output description is
incomplete.
lstape shows "N/A" instead of the HBA device bus-ID with
virtio-scsi-ccw.
Problem: s390-tools-1.8.0 before the first upstream commit b627b8d8e1ab
("Initial s390-tools-2.0.0 import") introduced SCSI
tape/changer output for lstape. It used the SCSI device serial
number as lookup key to find a match in IBM lin_tape device
driver proc-fs output for a given SCSI device name. Multiple
paths to the same tape/changer have the same serial number.
Multiple matches cause excess arguments to printf. Explaining
the resulting output, the bash man page says: "The format is
reused as necessary to consume all of the arguments." This
also causes a wrong number of found devices.
The default bash settings 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.
lsluns iterates SCSI generic devices and unconditionally
reads zfcp-specific SCSI device sysfs attributes hba_id, wwpn,
and fcp_lun.
lstape --verbose unconditionally reads zfcp-specific SCSI
device sysfs attributes hba_id and wwpn.
<devbusid> filter missing from synopsis. <device-type> example
at wrong place with <devbusid> filter. <devbusid> filter
option description is a duplicate of <device-type> filter
option description. SCSI output description misses fields.
Lstape only used the zfcp-specific sysfs attribute hba_id.
Solution: Prefer sysfs to find lin_tape device name for SCSI device.
Fallback: The lin_tape proc-fs output format has changed over
the years. The HBA device driver string can contain whitespace
(e.g. "Virtio SCSI HBA") and breaks the field numbers with
tokenized parsing. Grep for the SCSI device name as word (to
skip names with same substring, such as 0:0:1:1 also matching
0:0:1:10) and cut the first field 'Number' (lin_tape device
name suffix). If there is no SCSI column at all [lin_tape
before v2.2.0] (and no SCSI LLDD or other column with a name
accidentally matching an existing SCSI device name), we get no
match and better bail out with the initialized "N/A" for the
lstape column "Device".
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.
Simply skip non-zfcp SCSI devices, such as iSCSI or
virtio-scsi-ccw, to not erroneously access absent attributes.
Assume "N/A" for HBA and WWPN of non-zfcp SCSI devices, such
as iSCSI or virtio-scsi-ccw, to not erroneously access absent
zfcp-specific sysfs attributes.
Add <devbusid> filter to synopsis. Move <device-type> example
to <device-type> option. Replace <devbusid> filter option
description. Move existing SCSI output description to a new
subsection and add description of missing fields.
Also search sysfs for an ancestor with subsystem ccw.
Reproduction: Attach more than one path to the same SCSI tape or changer and
load the IBM lin_tape device driver.
Unload sg kernel module.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
man lstape
Attach SCSI tape or changer with virtio-scsi-ccw to a KVM
guest and run "lstape --verbose".
Upstream-ID: -
Problem-ID: 170633
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
zconf/lstape | 12 ++++++++++--
zconf/lstape.8 | 8 +++++++-
2 files changed, 17 insertions(+), 3 deletions(-)
--- a/zconf/lstape
+++ b/zconf/lstape
@@ -48,6 +48,9 @@ function PrintUsage() {
: -v|--version
: Display the version of the tools package and
: the lstape command.
+ :
+ :$(basename $0) without the --ccw-only option causes extra SAN traffic
+ :for each SCSI tape or changer device by invoking the sg_inq command.
EOD
}
@@ -249,11 +252,16 @@ function SysfsCreateListSCSI()
if [ -h $SG_DEV ]; then
# deprecated sysfs layout
SG_DEV=$(echo $SG_DEV | awk -F: '{print $NF}')
- else
+ elif [ -d $SCSI_DEV/scsi_generic ]; then
SG_DEV=$(basename $SG_DEV/*)
+ else
+ SG_DEV=""
fi
- if [ "$SG_INQ" != "" ]; then
+ if [ -z "$SG_DEV" ]; then
+ SG_DEV="N/A"
+ TAPE_SERIAL="NO/SG"
+ elif [ "$SG_INQ" != "" ]; then
TAPE_SERIAL=$(
sg_inq /dev/$SG_DEV |
awk '/serial/{print $NF}'
--- a/zconf/lstape.8
+++ b/zconf/lstape.8
@@ -36,7 +36,13 @@ IBM tape driver this would be "IBMtape"
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 tape's serial.
+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

View File

@ -0,0 +1,177 @@
Subject: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
From: Steffen Maier <maier@linux.ibm.com>
Description: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
Symptom: lstape shows unexpected additional Device suffix numbers in
excess output columns for each additional path of the same
tape/changer driven by the IBM lin_tape device driver
(independent of actual path failover enablement in lin_tape).
It also shows a wrong number of found devices in the header
(without --scsi-only).
lstape prints error about "Unexpected extra argument:" and the
usage for "sg_inq" along with wrong tabular output.
lsluns prints ENOENT error text for "cat" on SCSI device sysfs
attributes hba_id, wwpn, and fcp_lun.
lstape with --verbose option prints ENOENT error text for
"cat" on SCSI device sysfs attributes hba_id and wwpn.
lstape man page: Description of --type and <devbusid> filter
for channel tapes is incomplete. SCSI output description is
incomplete.
lstape shows "N/A" instead of the HBA device bus-ID with
virtio-scsi-ccw.
Problem: s390-tools-1.8.0 before the first upstream commit b627b8d8e1ab
("Initial s390-tools-2.0.0 import") introduced SCSI
tape/changer output for lstape. It used the SCSI device serial
number as lookup key to find a match in IBM lin_tape device
driver proc-fs output for a given SCSI device name. Multiple
paths to the same tape/changer have the same serial number.
Multiple matches cause excess arguments to printf. Explaining
the resulting output, the bash man page says: "The format is
reused as necessary to consume all of the arguments." This
also causes a wrong number of found devices.
The default bash settings 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.
lsluns iterates SCSI generic devices and unconditionally
reads zfcp-specific SCSI device sysfs attributes hba_id, wwpn,
and fcp_lun.
lstape --verbose unconditionally reads zfcp-specific SCSI
device sysfs attributes hba_id and wwpn.
<devbusid> filter missing from synopsis. <device-type> example
at wrong place with <devbusid> filter. <devbusid> filter
option description is a duplicate of <device-type> filter
option description. SCSI output description misses fields.
Lstape only used the zfcp-specific sysfs attribute hba_id.
Solution: Prefer sysfs to find lin_tape device name for SCSI device.
Fallback: The lin_tape proc-fs output format has changed over
the years. The HBA device driver string can contain whitespace
(e.g. "Virtio SCSI HBA") and breaks the field numbers with
tokenized parsing. Grep for the SCSI device name as word (to
skip names with same substring, such as 0:0:1:1 also matching
0:0:1:10) and cut the first field 'Number' (lin_tape device
name suffix). If there is no SCSI column at all [lin_tape
before v2.2.0] (and no SCSI LLDD or other column with a name
accidentally matching an existing SCSI device name), we get no
match and better bail out with the initialized "N/A" for the
lstape column "Device".
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.
Simply skip non-zfcp SCSI devices, such as iSCSI or
virtio-scsi-ccw, to not erroneously access absent attributes.
Assume "N/A" for HBA and WWPN of non-zfcp SCSI devices, such
as iSCSI or virtio-scsi-ccw, to not erroneously access absent
zfcp-specific sysfs attributes.
Add <devbusid> filter to synopsis. Move <device-type> example
to <device-type> option. Replace <devbusid> filter option
description. Move existing SCSI output description to a new
subsection and add description of missing fields.
Also search sysfs for an ancestor with subsystem ccw.
Reproduction: Attach more than one path to the same SCSI tape or changer and
load the IBM lin_tape device driver.
Unload sg kernel module.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
man lstape
Attach SCSI tape or changer with virtio-scsi-ccw to a KVM
guest and run "lstape --verbose".
Upstream-ID: -
Problem-ID: 170633
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
zconf/lsluns | 14 +++++++++-----
zconf/lsluns.8 | 5 ++---
2 files changed, 11 insertions(+), 8 deletions(-)
--- a/zconf/lsluns
+++ b/zconf/lsluns
@@ -2,7 +2,7 @@
#
# lsluns - list LUNs discovered in the FC SAN, or show encryption state of attached LUNs
#
-# Copyright IBM Corp. 2008, 2017
+# Copyright IBM Corp. 2008, 2018
#
# s390-tools is free software; you can redistribute it and/or modify
# it under the terms of the MIT license. See LICENSE for details.
@@ -152,6 +152,11 @@ sub get_lun_hash
my %lun_hash;
foreach my $device (</$sg_dir/sg*>) {
+ # skip non-zfcp SCSI devices and avoid file access error messages
+ next unless -r "$device/device/fcp_lun";
+ next unless -r "$device/device/wwpn";
+ next unless -r "$device/device/hba_id";
+
my $l = `cat $device/device/fcp_lun`;
my $p = `cat $device/device/wwpn`;
my $a = `cat $device/device/hba_id`;
@@ -170,9 +175,8 @@ sub get_lun_hash
sub lsluns_usage {
print <<EOD;
Usage:
-This tool is designed for environments where all SCSI devices are attached
-through the zfcp device driver. Expect error messages in mixed environments
-such as with iSCSI.
+This tool is designed for environments with SCSI devices attached
+through the zfcp device driver.
$PROGRAM_NAME [-c <busid>] ... [-p <wwpn>] ... [-h] [-v]
@@ -220,7 +224,7 @@ EOD
sub lsluns_version {
print "$PROGRAM_NAME: version %S390_TOOLS_VERSION%\n";
- print "Copyright IBM Corp. 2008, 2017\n";
+ print "Copyright IBM Corp. 2008, 2018\n";
}
sub lsluns_invalid_usage {
--- a/zconf/lsluns.8
+++ b/zconf/lsluns.8
@@ -28,9 +28,8 @@ zfcp-attached LUNs
.SH DESCRIPTION
.PP
-This tool is designed for environments where all SCSI devices are attached
-through the zfcp device driver. Expect error messages in mixed environments
-such as with iSCSI.
+This tool is designed for environments with SCSI devices attached
+through the zfcp device driver.
.B lsluns
lists all logical unit numbers (LUNs) discovered in the

View File

@ -0,0 +1,136 @@
Subject: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
From: Steffen Maier <maier@linux.ibm.com>
Description: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
Symptom: lstape shows unexpected additional Device suffix numbers in
excess output columns for each additional path of the same
tape/changer driven by the IBM lin_tape device driver
(independent of actual path failover enablement in lin_tape).
It also shows a wrong number of found devices in the header
(without --scsi-only).
lstape prints error about "Unexpected extra argument:" and the
usage for "sg_inq" along with wrong tabular output.
lsluns prints ENOENT error text for "cat" on SCSI device sysfs
attributes hba_id, wwpn, and fcp_lun.
lstape with --verbose option prints ENOENT error text for
"cat" on SCSI device sysfs attributes hba_id and wwpn.
lstape man page: Description of --type and <devbusid> filter
for channel tapes is incomplete. SCSI output description is
incomplete.
lstape shows "N/A" instead of the HBA device bus-ID with
virtio-scsi-ccw.
Problem: s390-tools-1.8.0 before the first upstream commit b627b8d8e1ab
("Initial s390-tools-2.0.0 import") introduced SCSI
tape/changer output for lstape. It used the SCSI device serial
number as lookup key to find a match in IBM lin_tape device
driver proc-fs output for a given SCSI device name. Multiple
paths to the same tape/changer have the same serial number.
Multiple matches cause excess arguments to printf. Explaining
the resulting output, the bash man page says: "The format is
reused as necessary to consume all of the arguments." This
also causes a wrong number of found devices.
The default bash settings 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.
lsluns iterates SCSI generic devices and unconditionally
reads zfcp-specific SCSI device sysfs attributes hba_id, wwpn,
and fcp_lun.
lstape --verbose unconditionally reads zfcp-specific SCSI
device sysfs attributes hba_id and wwpn.
<devbusid> filter missing from synopsis. <device-type> example
at wrong place with <devbusid> filter. <devbusid> filter
option description is a duplicate of <device-type> filter
option description. SCSI output description misses fields.
Lstape only used the zfcp-specific sysfs attribute hba_id.
Solution: Prefer sysfs to find lin_tape device name for SCSI device.
Fallback: The lin_tape proc-fs output format has changed over
the years. The HBA device driver string can contain whitespace
(e.g. "Virtio SCSI HBA") and breaks the field numbers with
tokenized parsing. Grep for the SCSI device name as word (to
skip names with same substring, such as 0:0:1:1 also matching
0:0:1:10) and cut the first field 'Number' (lin_tape device
name suffix). If there is no SCSI column at all [lin_tape
before v2.2.0] (and no SCSI LLDD or other column with a name
accidentally matching an existing SCSI device name), we get no
match and better bail out with the initialized "N/A" for the
lstape column "Device".
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.
Simply skip non-zfcp SCSI devices, such as iSCSI or
virtio-scsi-ccw, to not erroneously access absent attributes.
Assume "N/A" for HBA and WWPN of non-zfcp SCSI devices, such
as iSCSI or virtio-scsi-ccw, to not erroneously access absent
zfcp-specific sysfs attributes.
Add <devbusid> filter to synopsis. Move <device-type> example
to <device-type> option. Replace <devbusid> filter option
description. Move existing SCSI output description to a new
subsection and add description of missing fields.
Also search sysfs for an ancestor with subsystem ccw.
Reproduction: Attach more than one path to the same SCSI tape or changer and
load the IBM lin_tape device driver.
Unload sg kernel module.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
man lstape
Attach SCSI tape or changer with virtio-scsi-ccw to a KVM
guest and run "lstape --verbose".
Upstream-ID: -
Problem-ID: 170633
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
zconf/lstape | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/zconf/lstape
+++ b/zconf/lstape
@@ -335,9 +335,13 @@ function SysfsCreateListSCSI()
$STATE
if $VERBOSE; then
+ HBA_ID="N/A"
+ [ -r $SCSI_DEV/hba_id ] && HBA_ID=$(cat $SCSI_DEV/hba_id)
+ WWPN="N/A"
+ [ -r $SCSI_DEV/wwpn ] && WWPN=$(cat $SCSI_DEV/wwpn)
printf "$SCSIVFORMAT" \
- $(cat $SCSI_DEV/hba_id) \
- $(cat $SCSI_DEV/wwpn) \
+ "$HBA_ID" \
+ "$WWPN" \
$TAPE_SERIAL
fi
done

View File

@ -0,0 +1,147 @@
Subject: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
From: Steffen Maier <maier@linux.ibm.com>
Description: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
Symptom: lstape shows unexpected additional Device suffix numbers in
excess output columns for each additional path of the same
tape/changer driven by the IBM lin_tape device driver
(independent of actual path failover enablement in lin_tape).
It also shows a wrong number of found devices in the header
(without --scsi-only).
lstape prints error about "Unexpected extra argument:" and the
usage for "sg_inq" along with wrong tabular output.
lsluns prints ENOENT error text for "cat" on SCSI device sysfs
attributes hba_id, wwpn, and fcp_lun.
lstape with --verbose option prints ENOENT error text for
"cat" on SCSI device sysfs attributes hba_id and wwpn.
lstape man page: Description of --type and <devbusid> filter
for channel tapes is incomplete. SCSI output description is
incomplete.
lstape shows "N/A" instead of the HBA device bus-ID with
virtio-scsi-ccw.
Problem: s390-tools-1.8.0 before the first upstream commit b627b8d8e1ab
("Initial s390-tools-2.0.0 import") introduced SCSI
tape/changer output for lstape. It used the SCSI device serial
number as lookup key to find a match in IBM lin_tape device
driver proc-fs output for a given SCSI device name. Multiple
paths to the same tape/changer have the same serial number.
Multiple matches cause excess arguments to printf. Explaining
the resulting output, the bash man page says: "The format is
reused as necessary to consume all of the arguments." This
also causes a wrong number of found devices.
The default bash settings 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.
lsluns iterates SCSI generic devices and unconditionally
reads zfcp-specific SCSI device sysfs attributes hba_id, wwpn,
and fcp_lun.
lstape --verbose unconditionally reads zfcp-specific SCSI
device sysfs attributes hba_id and wwpn.
<devbusid> filter missing from synopsis. <device-type> example
at wrong place with <devbusid> filter. <devbusid> filter
option description is a duplicate of <device-type> filter
option description. SCSI output description misses fields.
Lstape only used the zfcp-specific sysfs attribute hba_id.
Solution: Prefer sysfs to find lin_tape device name for SCSI device.
Fallback: The lin_tape proc-fs output format has changed over
the years. The HBA device driver string can contain whitespace
(e.g. "Virtio SCSI HBA") and breaks the field numbers with
tokenized parsing. Grep for the SCSI device name as word (to
skip names with same substring, such as 0:0:1:1 also matching
0:0:1:10) and cut the first field 'Number' (lin_tape device
name suffix). If there is no SCSI column at all [lin_tape
before v2.2.0] (and no SCSI LLDD or other column with a name
accidentally matching an existing SCSI device name), we get no
match and better bail out with the initialized "N/A" for the
lstape column "Device".
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.
Simply skip non-zfcp SCSI devices, such as iSCSI or
virtio-scsi-ccw, to not erroneously access absent attributes.
Assume "N/A" for HBA and WWPN of non-zfcp SCSI devices, such
as iSCSI or virtio-scsi-ccw, to not erroneously access absent
zfcp-specific sysfs attributes.
Add <devbusid> filter to synopsis. Move <device-type> example
to <device-type> option. Replace <devbusid> filter option
description. Move existing SCSI output description to a new
subsection and add description of missing fields.
Also search sysfs for an ancestor with subsystem ccw.
Reproduction: Attach more than one path to the same SCSI tape or changer and
load the IBM lin_tape device driver.
Unload sg kernel module.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
man lstape
Attach SCSI tape or changer with virtio-scsi-ccw to a KVM
guest and run "lstape --verbose".
Upstream-ID: -
Problem-ID: 170633
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
zconf/lstape.8 | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
--- a/zconf/lstape.8
+++ b/zconf/lstape.8
@@ -20,6 +20,8 @@ lstape \- list tape devices.
.br
.RB [ -t
.IR <device-type> [, <device-type> ] "" ...]
+.br
+.RI [ <device-bus-ID> ...]
.SH DESCRIPTION
The lstape command lists all available tape devices on the current host. For
@@ -78,12 +80,14 @@ 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
+Limit output to given device types, for example 3490
+(currently only applies to channel-attached
tape devices).
.TP
-\fB<device-type>\fR =
-Device type of devices that should be displayed (e.g. 3490).
+.I <device-bus-ID>
+Limits the output to information about the specified tape device or
+devices only. For CCW-attached devices only.
.SH EXAMPLES
\fBlstape\fR

View File

@ -0,0 +1,206 @@
Subject: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
From: Steffen Maier <maier@linux.ibm.com>
Description: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
Symptom: lstape shows unexpected additional Device suffix numbers in
excess output columns for each additional path of the same
tape/changer driven by the IBM lin_tape device driver
(independent of actual path failover enablement in lin_tape).
It also shows a wrong number of found devices in the header
(without --scsi-only).
lstape prints error about "Unexpected extra argument:" and the
usage for "sg_inq" along with wrong tabular output.
lsluns prints ENOENT error text for "cat" on SCSI device sysfs
attributes hba_id, wwpn, and fcp_lun.
lstape with --verbose option prints ENOENT error text for
"cat" on SCSI device sysfs attributes hba_id and wwpn.
lstape man page: Description of --type and <devbusid> filter
for channel tapes is incomplete. SCSI output description is
incomplete.
lstape shows "N/A" instead of the HBA device bus-ID with
virtio-scsi-ccw.
Problem: s390-tools-1.8.0 before the first upstream commit b627b8d8e1ab
("Initial s390-tools-2.0.0 import") introduced SCSI
tape/changer output for lstape. It used the SCSI device serial
number as lookup key to find a match in IBM lin_tape device
driver proc-fs output for a given SCSI device name. Multiple
paths to the same tape/changer have the same serial number.
Multiple matches cause excess arguments to printf. Explaining
the resulting output, the bash man page says: "The format is
reused as necessary to consume all of the arguments." This
also causes a wrong number of found devices.
The default bash settings 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.
lsluns iterates SCSI generic devices and unconditionally
reads zfcp-specific SCSI device sysfs attributes hba_id, wwpn,
and fcp_lun.
lstape --verbose unconditionally reads zfcp-specific SCSI
device sysfs attributes hba_id and wwpn.
<devbusid> filter missing from synopsis. <device-type> example
at wrong place with <devbusid> filter. <devbusid> filter
option description is a duplicate of <device-type> filter
option description. SCSI output description misses fields.
Lstape only used the zfcp-specific sysfs attribute hba_id.
Solution: Prefer sysfs to find lin_tape device name for SCSI device.
Fallback: The lin_tape proc-fs output format has changed over
the years. The HBA device driver string can contain whitespace
(e.g. "Virtio SCSI HBA") and breaks the field numbers with
tokenized parsing. Grep for the SCSI device name as word (to
skip names with same substring, such as 0:0:1:1 also matching
0:0:1:10) and cut the first field 'Number' (lin_tape device
name suffix). If there is no SCSI column at all [lin_tape
before v2.2.0] (and no SCSI LLDD or other column with a name
accidentally matching an existing SCSI device name), we get no
match and better bail out with the initialized "N/A" for the
lstape column "Device".
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.
Simply skip non-zfcp SCSI devices, such as iSCSI or
virtio-scsi-ccw, to not erroneously access absent attributes.
Assume "N/A" for HBA and WWPN of non-zfcp SCSI devices, such
as iSCSI or virtio-scsi-ccw, to not erroneously access absent
zfcp-specific sysfs attributes.
Add <devbusid> filter to synopsis. Move <device-type> example
to <device-type> option. Replace <devbusid> filter option
description. Move existing SCSI output description to a new
subsection and add description of missing fields.
Also search sysfs for an ancestor with subsystem ccw.
Reproduction: Attach more than one path to the same SCSI tape or changer and
load the IBM lin_tape device driver.
Unload sg kernel module.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
man lstape
Attach SCSI tape or changer with virtio-scsi-ccw to a KVM
guest and run "lstape --verbose".
Upstream-ID: -
Problem-ID: 170633
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
zconf/lstape.8 | 68 +++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 54 insertions(+), 14 deletions(-)
--- a/zconf/lstape.8
+++ b/zconf/lstape.8
@@ -29,20 +29,6 @@ channel attached tape devices this outpu
/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.
@@ -89,6 +75,55 @@ tape devices).
Limits the output to information about the specified tape device or
devices only. For CCW-attached devices only.
+.SH OUTPUT FIELDS FOR SCSI TAPE/CHANGER DEVICES
+.TP
+.B Generic
+SCSI generic device file for the tape drive, for example /dev/sg0.
+"N/A" if the SCSI generic (sg) kernel functionality is not available.
+.TP
+.B Device
+Main character device node file for accessing the tape drive or medium changer.
+SCSI tape devices 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. The
+lstape command tries to determine the device driver. 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 device driver could not be determined.
+.TP
+.B Target
+Linux SCSI device name in H:C:T:L format.
+.TP
+.B Vendor
+The vendor field from the SCSI device.
+.TP
+.B Model
+The model field from the SCSI device.
+.TP
+.B Type
+"tapedrv" for a tape drive or "changer" for a medium changer.
+.TP
+.B State
+The state of the SCSI device object in the kernel.
+Any state other than "running" can indicate problems.
+
+.PP
+
+For SCSI devices, the --verbose option additionally displays:
+.TP
+.B HBA
+The device bus-ID of the FCP device
+through which the tape drive is attached.
+"N/A" if device is not attached through zfcp.
+.TP
+.B WWPN
+The WWPN (worldwide port name) of the tape drive in the SAN.
+"N/A" if device is not attached through zfcp.
+.TP
+.B Serial
+The serial number.
+"NO/INQ" if there is no sg_inq command available.
+"NO/SG" if no SCSI generic (sg) kernel support is available.
+
.SH EXAMPLES
\fBlstape\fR
.RS
@@ -99,3 +134,8 @@ List all tape devices that are available
.RS
Show all 3490 CCW devices that are online.
.RE
+
+\fBlstape --scsi-only --verbose\fR
+.RS
+Show all SCSI tape or changer devices with maximum information.
+.RE

View File

@ -0,0 +1,173 @@
Subject: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
From: Steffen Maier <maier@linux.ibm.com>
Description: lstape, lsluns: handle non-zfcp; lin_tape multiple paths
Symptom: lstape shows unexpected additional Device suffix numbers in
excess output columns for each additional path of the same
tape/changer driven by the IBM lin_tape device driver
(independent of actual path failover enablement in lin_tape).
It also shows a wrong number of found devices in the header
(without --scsi-only).
lstape prints error about "Unexpected extra argument:" and the
usage for "sg_inq" along with wrong tabular output.
lsluns prints ENOENT error text for "cat" on SCSI device sysfs
attributes hba_id, wwpn, and fcp_lun.
lstape with --verbose option prints ENOENT error text for
"cat" on SCSI device sysfs attributes hba_id and wwpn.
lstape man page: Description of --type and <devbusid> filter
for channel tapes is incomplete. SCSI output description is
incomplete.
lstape shows "N/A" instead of the HBA device bus-ID with
virtio-scsi-ccw.
Problem: s390-tools-1.8.0 before the first upstream commit b627b8d8e1ab
("Initial s390-tools-2.0.0 import") introduced SCSI
tape/changer output for lstape. It used the SCSI device serial
number as lookup key to find a match in IBM lin_tape device
driver proc-fs output for a given SCSI device name. Multiple
paths to the same tape/changer have the same serial number.
Multiple matches cause excess arguments to printf. Explaining
the resulting output, the bash man page says: "The format is
reused as necessary to consume all of the arguments." This
also causes a wrong number of found devices.
The default bash settings 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.
lsluns iterates SCSI generic devices and unconditionally
reads zfcp-specific SCSI device sysfs attributes hba_id, wwpn,
and fcp_lun.
lstape --verbose unconditionally reads zfcp-specific SCSI
device sysfs attributes hba_id and wwpn.
<devbusid> filter missing from synopsis. <device-type> example
at wrong place with <devbusid> filter. <devbusid> filter
option description is a duplicate of <device-type> filter
option description. SCSI output description misses fields.
Lstape only used the zfcp-specific sysfs attribute hba_id.
Solution: Prefer sysfs to find lin_tape device name for SCSI device.
Fallback: The lin_tape proc-fs output format has changed over
the years. The HBA device driver string can contain whitespace
(e.g. "Virtio SCSI HBA") and breaks the field numbers with
tokenized parsing. Grep for the SCSI device name as word (to
skip names with same substring, such as 0:0:1:1 also matching
0:0:1:10) and cut the first field 'Number' (lin_tape device
name suffix). If there is no SCSI column at all [lin_tape
before v2.2.0] (and no SCSI LLDD or other column with a name
accidentally matching an existing SCSI device name), we get no
match and better bail out with the initialized "N/A" for the
lstape column "Device".
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.
Simply skip non-zfcp SCSI devices, such as iSCSI or
virtio-scsi-ccw, to not erroneously access absent attributes.
Assume "N/A" for HBA and WWPN of non-zfcp SCSI devices, such
as iSCSI or virtio-scsi-ccw, to not erroneously access absent
zfcp-specific sysfs attributes.
Add <devbusid> filter to synopsis. Move <device-type> example
to <device-type> option. Replace <devbusid> filter option
description. Move existing SCSI output description to a new
subsection and add description of missing fields.
Also search sysfs for an ancestor with subsystem ccw.
Reproduction: Attach more than one path to the same SCSI tape or changer and
load the IBM lin_tape device driver.
Unload sg kernel module.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
Attach non-zfcp SCSI devices such as iSCSI or virtio-scsi-ccw.
man lstape
Attach SCSI tape or changer with virtio-scsi-ccw to a KVM
guest and run "lstape --verbose".
Upstream-ID: -
Problem-ID: 170633
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
zconf/lstape | 25 +++++++++++++++++++++++--
zconf/lstape.8 | 3 ++-
2 files changed, 25 insertions(+), 3 deletions(-)
--- a/zconf/lstape
+++ b/zconf/lstape
@@ -223,6 +223,24 @@ function SysfsCreateListCCW() {
' | sort
}
+# handle SCSI device not necessarily zfcp-attached, e.g. virtio-scsi-ccw
+function SCSISearchCCWBusid()
+{
+ local SCSI_DEV=$1
+ local SDEVCAN=$(readlink -e $SCSI_DEV)
+ while [ -n "$SDEVCAN" ]; do
+ # ascend to parent: strip last path part
+ SDEVCAN=${SDEVCAN%/*}
+ [ -h $SDEVCAN/subsystem ] || continue
+ local SUBSYSTEM=$(readlink -e $SDEVCAN/subsystem)
+ if [ "${SUBSYSTEM##*/}" = "ccw" ]; then
+ echo ${SDEVCAN##*/}
+ return
+ fi
+ done
+ echo "N/A"
+}
+
function SysfsCreateListSCSI()
{
for SCSI_DEV in $1/bus/scsi/devices/*:*:*:*; do
@@ -335,8 +353,11 @@ function SysfsCreateListSCSI()
$STATE
if $VERBOSE; then
- HBA_ID="N/A"
- [ -r $SCSI_DEV/hba_id ] && HBA_ID=$(cat $SCSI_DEV/hba_id)
+ if [ -r $SCSI_DEV/hba_id ]; then
+ HBA_ID=$(cat $SCSI_DEV/hba_id)
+ else
+ HBA_ID=$(SCSISearchCCWBusid $SCSI_DEV)
+ fi
WWPN="N/A"
[ -r $SCSI_DEV/wwpn ] && WWPN=$(cat $SCSI_DEV/wwpn)
printf "$SCSIVFORMAT" \
--- a/zconf/lstape.8
+++ b/zconf/lstape.8
@@ -112,8 +112,9 @@ For SCSI devices, the --verbose option a
.TP
.B HBA
The device bus-ID of the FCP device
+or of the virtio-scsi-ccw virtual HBA
through which the tape drive is attached.
-"N/A" if device is not attached through zfcp.
+"N/A" if the device does not have a sysfs ancestor with subsystem ccw.
.TP
.B WWPN
The WWPN (worldwide port name) of the tape drive in the SAN.

View File

@ -0,0 +1,69 @@
Subject: [PATCH] [BZ 168517] dbginfo.sh: Extend data collection
From: Sa Liu <saliu@de.ibm.com>
Description: dbginfo.sh: Extend data collection
Symptom: This update covers various symptoms on dbginfo.sh data
collection:
- There is no data collected for docker.
- ps command does not show threads infomation.
- There is no run queue statistics and scheduler data.
- z/VM commands do not show multithread, protect
settings and SSI status.
Problem: Following problems exist:
- No analysis is possible for docker data.
- Missing thread information.
- Missing run queue statistics and scheduler data.
- Missing z/VM information.
Solution: - Extend the data collection to collect docker data
- Change ps command to show threads informaton
- Add commands to display run queue statistics and
scheduler data.
- Add z/VM commands to show multithread, protect settings
and SSI status.
Reproduction: Run this script and verify the output
Upstream-ID: -
Problem-ID: 168517
Signed-off-by: Sa Liu <saliu@de.ibm.com>
---
scripts/dbginfo.sh | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--- a/scripts/dbginfo.sh
+++ b/scripts/dbginfo.sh
@@ -375,7 +375,8 @@ CMDS="uname -a\
:runlevel\
:iptables -L\
:ulimit -a\
- :ps -eo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\
+ :ps -emo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\
+ :ps -eHo pid,tid,nlwp,policy,user,tname,ni,pri,psr,sgi_p,stat,wchan,start_time,time,pcpu,pmem,vsize,size,rss,share,command\
:ps axX\
:dmesg -s 1048576\
:last\
@@ -470,6 +471,8 @@ VM_CMDS="q userid\
:q privclass\
:q cplevel\
:q cpservice\
+ :q cpprot user\
+ :q specex\
:q ssi\
:q cpus\
:q srm\
@@ -508,6 +511,7 @@ VM_CMDS="q userid\
:q cache\
:q nic\
:q pav\
+ :q proc\
:q proc topology\
:q mt\
:q qioass\
@@ -831,7 +835,7 @@ post_processing() {
local tmp_file
local file_name
- pr_syslog_stdout "11 of ${COLLECTION_COUNT}: Postprocessing"
+ pr_syslog_stdout "${COLLECTION_COUNT} of ${COLLECTION_COUNT}: Postprocessing"
find "${WORKPATH}etc/libvirt/qemu/" -maxdepth 1 -name "*.xml" 2>/dev/null | while IFS= read -r file_name; do
file_mtime_epoche=$(stat --format=%Y "${file_name}")

View File

@ -0,0 +1,71 @@
Subject: mon_procd: fix parsing of /proc/<pid>/stat
From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Description: mon_procd: fix parsing of /proc/<pid>/stat
Symptom: Wrong data from /proc/<pid>/stat for processes that contain
a ")" in their name.
Problem: The output of /proc/<pid>/stat will show the process name in
parentheses. The parsing code in read_stat() tries to filter
out the parentheses, which will go wrong when the process name
itself also contains parentheses, e.g. in an output like this:
"2421 ((sd-pam)) S 2420 2420 2420 ..."
In this case, the first closing parentheses will be taken as
end marker, and the sscanf() on the remaining string will
silently fail, leaving its values in uninitialized state and
producing wrong data.
Solution: Use strrchr() instead of strchr() to find the last closing
parentheses. Also add return value checking for sscanf() and
initialize the values to 0.
Reproduction: Use mon_procd on a system with running processes that have a
")" in their name, like "(sd-pam)".
Upstream-ID: -
Problem-ID: 169483
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
---
mon_tools/mon_procd.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
--- a/mon_tools/mon_procd.c
+++ b/mon_tools/mon_procd.c
@@ -594,17 +594,18 @@ static void cal_task_pcpu(struct task_t
*/
static int read_stat(struct task_t *task)
{
- int ppid, tty, proc;
- unsigned long flags, pri, nice;
- unsigned long long maj_flt, utime, stime, cutime, cstime;
+ unsigned long long maj_flt = 0, utime = 0, stime = 0, cutime = 0,
+ cstime = 0;
+ unsigned long flags = 0, pri = 0, nice = 0;
char *cmd_start, *cmd_end, *cmdlenp, *cmdp;
+ int ppid = 0, tty = 0, proc = 0, rc;
snprintf(fname, sizeof(fname), "/proc/%u/stat", task->pid);
if (read_file(fname, buf, sizeof(buf) - 1) == -1)
return 0;
cmd_start = strchr(buf, '(') + 1;
- cmd_end = strchr(cmd_start, ')');
+ cmd_end = strrchr(cmd_start, ')');
name_lens.cmd_len = cmd_end - cmd_start;
cmdlenp = mon_record + sizeof(struct monwrite_hdr);
cmdlenp += sizeof(struct procd_hdr);
@@ -625,7 +626,7 @@ static int read_stat(struct task_t *task
memcpy(cmdlenp, &name_lens.cmd_len, sizeof(__u16));
cmd_end += 2;
- sscanf(cmd_end,
+ rc = sscanf(cmd_end,
"%c %d %*d %*d %d %*d "
"%lu %*s %*s %Lu %*s "
"%Lu %Lu %Lu %Lu "
@@ -642,6 +643,8 @@ static int read_stat(struct task_t *task
&utime, &stime, &cutime, &cstime,
&pri, &nice,
&proc);
+ if (rc != 12)
+ syslog(LOG_ERR, "bad data in %s \n", fname);
task->ppid = (__u32)ppid;
task->tty = (__u16)tty;
task->flags = (__u32)flags;

View File

@ -1,3 +1,42 @@
-------------------------------------------------------------------
Fri Aug 31 18:57:54 UTC 2018 - mpost@suse.com
- Added the following patch for bsc#1094354
* customize-zdev-root-update-script.patch
- Modified ctc_configure to not pass a "protcol=" parameter when
configuring LCS devices. (bsc#1096520)
- Added the following patches for bsc#1098069
* s390-tools-sles15-dbginfo-add-data-for-ps-cpprot.patch
* s390-tools-sles15-mon_procd-fix-parsing-of-proc-pid-stat.patch
* s390-tools-sles15-1-lstape-fix-output-with-SCSI-lin_tape-and-multiple-pa.patch
* s390-tools-sles15-2-lstape-fix-to-prefer-sysfs-to-find-lin_tape-device-n.patch
* s390-tools-sles15-3-lstape-fix-output-without-SCSI-generic-sg.patch
* s390-tools-sles15-4-lsluns-fix-to-prevent-error-messages-if-there-are-no.patch
* s390-tools-sles15-5-lstape-fix-to-prevent-error-messages-if-there-are-no.patch
* s390-tools-sles15-6-lstape-fix-description-of-type-and-devbusid-filter-f.patch
* s390-tools-sles15-7-lstape-fix-SCSI-output-description-in-man-page.patch
* s390-tools-sles15-8-lstape-fix-SCSI-HBA-CCW-device-bus-ID-e.g.-for-virti.patch
-------------------------------------------------------------------
Tue Aug 7 04:44:12 UTC 2018 - mpost@suse.com
- dasd_reload: Fixed several syntax errors. Changed the script to
ensure that the DASD volume are actually activated in device
number order. If an old 51-dasd-<ccw>.rules file is found,
rename it to obsolete-51-dasd-<ccw>.rules, and use chzdev to
generate a new rules file. (bsc#1103407)
-------------------------------------------------------------------
Mon Aug 6 12:42:14 CEST 2018 - hare@suse.de
- dasd_reload: Check for 41-dasd-<type>-<ccw>.rules in addition
to the original 51-dasd-<ccw>.rules (bsc#1103407)
-------------------------------------------------------------------
Fri Jul 27 17:56:14 UTC 2018 - mpost@suse.com
- Removed s390 from the ExclusiveArch parameter (bsc#1102906)
-------------------------------------------------------------------
Wed May 30 10:22:01 CEST 2018 - hare@suse.de

View File

@ -141,9 +141,21 @@ Patch30: s390-tools-sles15-lsluns-complement-alternative-tools-with-lszde
Patch31: s390-tools-sles15-zdev-Enable-running-chzdev-from-unknown-root-devices.patch
Patch32: s390-tools-sles15-zdev-Fix-zdev-dracut-module-aborting-on-unknown-root.patch
Patch33: s390-tools-sles15-hmcdrvfs-fix-parsing-of-link-count.patch
Patch34: s390-tools-sles15-dbginfo-add-data-for-ps-cpprot.patch
Patch35: s390-tools-sles15-mon_procd-fix-parsing-of-proc-pid-stat.patch
Patch36: s390-tools-sles15-1-lstape-fix-output-with-SCSI-lin_tape-and-multiple-pa.patch
Patch37: s390-tools-sles15-2-lstape-fix-to-prefer-sysfs-to-find-lin_tape-device-n.patch
Patch38: s390-tools-sles15-3-lstape-fix-output-without-SCSI-generic-sg.patch
Patch39: s390-tools-sles15-4-lsluns-fix-to-prevent-error-messages-if-there-are-no.patch
Patch40: s390-tools-sles15-5-lstape-fix-to-prevent-error-messages-if-there-are-no.patch
Patch41: s390-tools-sles15-6-lstape-fix-description-of-type-and-devbusid-filter-f.patch
Patch42: s390-tools-sles15-7-lstape-fix-SCSI-output-description-in-man-page.patch
Patch43: s390-tools-sles15-8-lstape-fix-SCSI-HBA-CCW-device-bus-ID-e.g.-for-virti.patch
Patch999: customize-zdev-root-update-script.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: s390 s390x
ExclusiveArch: s390x
%description
This package contains the tools needed to use Linux on IBM z Systems
@ -230,6 +242,18 @@ to list files and directories.
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch999 -p1
cp -vi %{S:22} CAUTION