2017-02-21 12:14:26 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# zfcp_host_configure
|
|
|
|
#
|
2017-11-09 21:49:43 +01:00
|
|
|
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
|
|
#
|
|
|
|
# Configures a zfcp host adapter 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_host_configure <ccwid> <online>
|
|
|
|
#
|
|
|
|
# ccwid = x.y.ssss where
|
|
|
|
# x is always 0 until IBM creates something that uses that number
|
2023-11-13 14:50:17 +01:00
|
|
|
# y is the subchannel set ID (SSID). Most often
|
2017-11-09 21:49:43 +01:00
|
|
|
# this is 0, but it could be non-zero
|
2023-11-13 14:50:17 +01:00
|
|
|
# ssss is the four digit device address of the subchannel, in
|
2017-11-09 21:49:43 +01:00
|
|
|
# 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
|
|
|
|
#
|
|
|
|
# Return codes
|
2017-11-09 21:49:43 +01:00
|
|
|
# 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> <online>"
|
|
|
|
echo " ccwid = x.y.ssss where"
|
|
|
|
echo " x is always 0 until IBM creates something that uses that number"
|
2023-11-13 14:50:17 +01:00
|
|
|
echo " y is the subchannel set ID (SSID). Most often"
|
2017-11-09 21:49:43 +01:00
|
|
|
echo " this is 0, but it could be non-zero"
|
2023-11-13 14:50:17 +01:00
|
|
|
echo " ssss is the four digit device address of the subchannel, in"
|
2017-11-09 21:49:43 +01:00
|
|
|
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
|
|
|
DATE=$(date)
|
2017-02-21 12:14:26 +01:00
|
|
|
|
2017-11-09 21:49:43 +01:00
|
|
|
CCW_CHAN_ID=${1}
|
|
|
|
ON_OFF=${2}
|
2017-02-21 12:14:26 +01:00
|
|
|
|
2017-11-09 21:49:43 +01:00
|
|
|
if [ -z "${CCW_CHAN_ID}" ] || [ -z "${ON_OFF}" ]; then
|
|
|
|
mesg "You didn't specify all the needed parameters."
|
|
|
|
usage
|
|
|
|
exit 1
|
2017-02-21 12:14:26 +01:00
|
|
|
fi
|
|
|
|
|
2017-11-09 21:49:43 +01:00
|
|
|
if [ "${ON_OFF}" == 0 ]; then
|
2017-12-05 16:58:29 +01:00
|
|
|
debug_mesg "chzdev -d zfcp-host --no-root-update ${CCW_CHAN_ID}"
|
|
|
|
chzdev -d zfcp-host --no-root-update ${CCW_CHAN_ID}
|
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-host --no-root-update ${CCW_CHAN_ID}"
|
|
|
|
chzdev -e zfcp-host --no-root-update ${CCW_CHAN_ID}
|
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
|
|
|
|
|
2017-11-09 21:49:43 +01:00
|
|
|
RC=${?}
|
|
|
|
if [ ${RC} -ne 0 ]; then
|
|
|
|
exit ${RC}
|
2017-02-21 12:14:26 +01:00
|
|
|
fi
|