2017-02-21 12:14:26 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# zfcp_disk_configure
|
|
|
|
#
|
2017-11-09 21:49:43 +01:00
|
|
|
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
|
|
#
|
|
|
|
# Configures a zfcp SCSI disk by calling the IBM-provided chzdev command.
|
|
|
|
# Whereas this script used to validate the parameters provided to it,
|
|
|
|
# we now rely on chzdev to do that instead. The script is intended only
|
|
|
|
# as a "translation layer" to provide backward compatability for older
|
|
|
|
# scripts and tools that invoke it.
|
2017-02-21 12:14:26 +01:00
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# zfcp_disk_configure <ccwid> <wwpn> <lun> <online>
|
|
|
|
#
|
|
|
|
# ccwid = x.y.ssss where
|
|
|
|
# x is always 0 until IBM creates something that uses that number
|
2017-11-09 21:49:43 +01:00
|
|
|
# y is the logical channel subsystem (lcss) number. Most often
|
|
|
|
# this is 0, but it could be non-zero
|
|
|
|
# ssss is the four digit subchannel address of the device, in
|
|
|
|
# hexidecimal, with leading zeros.
|
2017-02-21 12:14:26 +01:00
|
|
|
# online = 0 to take the device offline
|
|
|
|
# 1 to bring the device online
|
|
|
|
#
|
2017-11-09 21:49:43 +01:00
|
|
|
# Return values:
|
|
|
|
# Return codes are determined by the chzdev command.
|
2017-02-21 12:14:26 +01:00
|
|
|
#
|
|
|
|
|
|
|
|
mesg () {
|
|
|
|
echo "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
debug_mesg () {
|
2017-11-09 21:49:43 +01:00
|
|
|
case "${DEBUG}" in
|
|
|
|
yes) mesg "$@" ;;
|
|
|
|
*) ;;
|
2017-02-21 12:14:26 +01:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2017-11-09 21:49:43 +01:00
|
|
|
usage(){
|
|
|
|
echo "Usage: ${0} <ccwid> <wwpn> <lun> <online>"
|
|
|
|
echo " ccwid = x.y.ssss where"
|
|
|
|
echo " x is always 0 until IBM creates something that uses that number"
|
|
|
|
echo " y is the logical channel subsystem (lcss) number. Most often"
|
|
|
|
echo " this is 0, but it could be non-zero"
|
|
|
|
echo " ssss is the four digit subchannel address of the device, in"
|
|
|
|
echo " hexidecimal, with leading zeros."
|
|
|
|
echo " online = 0 to take the device offline"
|
|
|
|
echo " 1 to bring the device online"
|
|
|
|
}
|
2017-10-25 19:52:12 +02:00
|
|
|
|
2017-11-09 21:49:43 +01:00
|
|
|
if [ "${DEBUG}" != "yes" ]; then
|
|
|
|
DEBUG="no"
|
2017-02-21 12:14:26 +01:00
|
|
|
fi
|
|
|
|
|
2017-11-09 21:49:43 +01:00
|
|
|
CCW_CHAN_ID=${1}
|
|
|
|
FCP_WWPN="${2}"
|
|
|
|
FCP_LUN="${3}"
|
|
|
|
ON_OFF=${4}
|
2017-02-21 12:14:26 +01:00
|
|
|
# normalise to lower case
|
2017-11-09 21:49:43 +01:00
|
|
|
FCP_WWPN=$(echo ${FCP_WWPN} | tr "A-Z" "a-z")
|
|
|
|
FCP_LUN=$(echo ${FCP_LUN} | tr "A-Z" "a-z")
|
|
|
|
|
|
|
|
if [ "${ON_OFF}" == 0 ]; then
|
2017-12-05 16:58:29 +01:00
|
|
|
debug_mesg "chzdev -d zfcp-lun --no-root-update ${CCW_CHAN_ID}:${FCP_WWPN}:${FCP_LUN}"
|
|
|
|
chzdev -d zfcp-lun --no-root-update ${CCW_CHAN_ID}:${FCP_WWPN}:${FCP_LUN}
|
2017-11-09 21:49:43 +01:00
|
|
|
elif [ "${ON_OFF}" == 1 ]; then
|
2017-12-05 16:58:29 +01:00
|
|
|
debug_mesg "chzdev -e zfcp-lun --no-root-update ${CCW_CHAN_ID}:${FCP_WWPN}:${FCP_LUN}"
|
|
|
|
chzdev -e zfcp-lun --no-root-update ${CCW_CHAN_ID}:${FCP_WWPN}:${FCP_LUN}
|
2017-11-09 21:49:43 +01:00
|
|
|
else mesg "You must specify a 0 or a 1 for the online/offline attribute."
|
|
|
|
usage
|
|
|
|
exit 1
|
2017-02-21 12:14:26 +01:00
|
|
|
fi
|