- add support for auto LUN scan to zfcpconf.sh (#1552697)

This commit is contained in:
Dan Horák 2020-08-26 10:49:18 +02:00
parent a9bf2dafeb
commit a895d0c8be
2 changed files with 26 additions and 3 deletions

View File

@ -6,7 +6,7 @@
Name: s390utils
Summary: Utilities and daemons for IBM z Systems
Version: 2.14.0
Release: 1%{?dist}
Release: 2%{?dist}
Epoch: 2
License: MIT
ExclusiveArch: s390 s390x
@ -792,6 +792,9 @@ User-space development files for the s390/s390x architecture.
%changelog
* Wed Aug 25 2020 Dan Horák <dan[at]danny.cz> - 2:2.14.0-2
- add support for auto LUN scan to zfcpconf.sh (#1552697)
* Tue Aug 25 2020 Dan Horák <dan[at]danny.cz> - 2:2.14.0-1
- rebased to 2.14.0

View File

@ -2,10 +2,12 @@
# config file syntax:
# deviceno WWPN FCPLUN
# deviceno # allowed when auto LUN scan is enabled and port is in NPIV mode
#
# Example:
# 0.0.4000 0x5005076300C213e9 0x5022000000000000
# 0.0.4001 0x5005076300c213e9 0x5023000000000000
# 0.0.5000
#
#
# manual setup:
@ -21,6 +23,14 @@
CONFIG=/etc/zfcp.conf
PATH=/bin:/sbin
set_online()
{
DEVICE=$1
[ `cat /sys/bus/ccw/drivers/zfcp/${DEVICE}/online` = "0" ] \
&& echo 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE}/online
}
if [ -f "$CONFIG" ]; then
if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
modprobe zfcp
@ -34,6 +44,17 @@ if [ -f "$CONFIG" ]; then
*)
[ -z "$line" ] && continue
set $line
if [ $# -eq 1 ]; then
DEVICE=${1##*0x}
if [ `cat /sys/module/zfcp/parameters/allow_lun_scan` = "Y" ]; then
set_online ${DEVICE}
grep -q NPIV /sys/bus/ccw/devices/${DEVICE}/host*/fc_host/host*/port_type || \
echo "Error: Only device ID (${DEVICE}) given, but port not in NPIV mode"
else
echo "Error: Only device ID (${DEVICE}) given, but LUN scan is disabled for the zfcp module"
fi
continue
fi
if [ $# -eq 5 ]; then
DEVICE=$1
SCSIID=$2
@ -46,8 +67,7 @@ if [ -f "$CONFIG" ]; then
WWPN=$2
FCPLUN=$3
fi
[ `cat /sys/bus/ccw/drivers/zfcp/${DEVICE}/online` = "0" ] \
&& echo 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE}/online
set_online ${DEVICE}
[ ! -d /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/${FCPLUN} ] \
&& echo $FCPLUN > /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/unit_add
;;