s390utils/zfcpconf.sh

56 lines
1.4 KiB
Bash
Raw Normal View History

2010-07-07 13:42:34 +00:00
#!/bin/sh
2009-04-07 08:03:09 +00:00
# config file syntax:
# deviceno WWPN FCPLUN
#
# Example:
# 0.0.4000 0x5005076300C213e9 0x5022000000000000
# 0.0.4001 0x5005076300c213e9 0x5023000000000000
#
#
# manual setup:
# modprobe zfcp
# echo 1 > /sys/bus/ccw/drivers/zfcp/0.0.4000/online
# echo LUN > /sys/bus/ccw/drivers/zfcp/0.0.4000/WWPN/unit_add
2009-04-07 08:03:09 +00:00
#
# Example:
# modprobe zfcp
# echo 1 > /sys/bus/ccw/drivers/zfcp/0.0.4000/online
# echo 0x5022000000000000 > /sys/bus/ccw/drivers/zfcp/0.0.4000/0x5005076300c213e9/unit_add
2009-04-07 08:03:09 +00:00
CONFIG=/etc/zfcp.conf
2010-07-07 13:42:34 +00:00
PATH=/bin:/sbin
2009-04-07 08:03:09 +00:00
if [ -f "$CONFIG" ]; then
if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
modprobe zfcp
fi
if [ ! -d /sys/bus/ccw/drivers/zfcp ]; then
return
fi
2010-07-07 13:42:34 +00:00
sed 'y/ABCDEF/abcdef/' < $CONFIG | while read line; do
case $line in
\#*) ;;
*)
[ -z "$line" ] && continue
set $line
if [ $# -eq 5 ]; then
DEVICE=$1
SCSIID=$2
WWPN=$3
SCSILUN=$4
FCPLUN=$5
echo "Warning: Deprecated values in /etc/zfcp.conf, ignoring SCSI ID $SCSIID and SCSI LUN $SCSILUN"
elif [ $# -eq 3 ]; then
DEVICE=${1##*0x}
WWPN=$2
FCPLUN=$3
fi
echo 1 > /sys/bus/ccw/drivers/zfcp/${DEVICE}/online
[ ! -d /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/${FCPLUN} ] \
&& echo $FCPLUN > /sys/bus/ccw/drivers/zfcp/${DEVICE}/${WWPN}/unit_add
;;
esac
2009-04-07 08:03:09 +00:00
done
fi