Hello community,
here is the log from the commit of package s390-tools for openSUSE:Factory checked in at 2017-11-14 12:42:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/s390-tools (Old)
and /work/SRC/openSUSE:Factory/.s390-tools.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "s390-tools"
Tue Nov 14 12:42:03 2017 rev:12 rq:541729 version:2.1.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/s390-tools/s390-tools.changes 2017-11-03 16:21:47.842877303 +0100
+++ /work/SRC/openSUSE:Factory/.s390-tools.new/s390-tools.changes 2017-11-14 12:42:04.944175232 +0100
@@ -1,0 +2,19 @@
+Tue Nov 14 03:19:55 UTC 2017 - mpost@suse.com
+
+- Added s390-tools-sles15-zdev-Use-correct-path-to-vmcp-binary.patch
+ zdev: Use correct path to vmcp binary (bsc#1055909)
+- Modified the spec file to also install /etc/cpuplugd.conf
+ (bsc#1066328)
+- Dropped installation of obsolete /etc/sysconfig/mon_statd.
+- Removed "-i" option from "fillup_only" macro for osasnmpd to get
+ rid of a warning message from RPM.
+
+-------------------------------------------------------------------
+Thu Nov 9 20:39:38 UTC 2017 - mpost@suse.com
+
+- Updated the cputype script to recognize the new IBM z14
+ processor (bsc#1049843).
+- Re-instated the new versions of ctc_configure, dasd_configure,
+ qeth_configure, zfcp_disk_configure, zfcp_host_configure.
+
+-------------------------------------------------------------------
New:
----
s390-tools-sles15-zdev-Use-correct-path-to-vmcp-binary.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ s390-tools.spec ++++++
--- /var/tmp/diff_new_pack.25NRop/_old 2017-11-14 12:42:06.664112319 +0100
+++ /var/tmp/diff_new_pack.25NRop/_new 2017-11-14 12:42:06.668112172 +0100
@@ -116,6 +116,7 @@
Patch14: s390-tools-sles12-fdasd-skip-partition-check-and-BLKRRPART-ioctl.patch
Patch15: s390-tools-sles15-Fix-truncation-warning.patch
Patch16: s390-tools-sles15-iucvterm-include-ctype-for-toupper.patch
+Patch17: s390-tools-sles15-zdev-Use-correct-path-to-vmcp-binary.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: s390 s390x
@@ -188,6 +189,7 @@
%patch14 -p1
%patch15 -p1
%patch16 -p1
+%patch17 -p1
cp -vi %{S:22} CAUTION
@@ -215,6 +217,7 @@
export ROOT_BUILD_DIR="%{_builddir}/%{name}-%{version}/zfcpdump/kernel"
install -D -m600 /boot/image-*-zfcpdump %{buildroot}/usr/lib/s390-tools/zfcpdump/zfcpdump_part.image
+install -D -m644 etc/cpuplugd.conf %{buildroot}/etc/cpuplugd.conf
install -D -m644 etc/udev/rules.d/40-z90crypt.rules %{buildroot}/usr/lib/udev/rules.d/40-z90crypt.rules
install -D -m644 etc/udev/rules.d/57-osasnmpd.rules %{buildroot}/usr/lib/udev/rules.d/57-osasnmpd.rules
install -D -m644 etc/udev/rules.d/59-dasd.rules %{buildroot}/usr/lib/udev/rules.d/59-dasd.rules
@@ -223,7 +226,6 @@
install -D -m644 etc/sysconfig/dumpconf %{buildroot}/var/adm/fillup-templates/sysconfig.dumpconf
install -D -m644 etc/sysconfig/mon_fsstatd %{buildroot}/var/adm/fillup-templates/sysconfig.mon_fsstatd
install -D -m644 etc/sysconfig/mon_procd %{buildroot}/var/adm/fillup-templates/sysconfig.mon_procd
-install -D -m644 etc/sysconfig/mon_statd %{buildroot}/var/adm/fillup-templates/sysconfig.mon_statd
mv iucvterm/doc/ts-shell/iucvconn_on_login %{buildroot}/usr/bin/iucvconn_on_login
install -D -m644 %{S:26} %{buildroot}/%{_unitdir}/cio_ignore.service
install -D -m755 %{S:27} %{buildroot}/usr/lib/systemd/scripts/setup_cio_ignore.sh
@@ -368,7 +370,7 @@
|| echo "/usr/bin/ts-shell" >> /etc/shells
%post -n osasnmpd
-%{fillup_only -i -n osasnmpd}
+%{fillup_only -n osasnmpd}
%preun
%{stop_on_removal appldata}
@@ -433,6 +435,7 @@
%config %attr(0640,root,ts-shell) /etc/iucvterm/ts-shell.conf
%config %attr(0640,root,ts-shell) /etc/iucvterm/unrestricted.conf
%config /etc/modprobe.d/90-s390-tools.conf
+%config /etc/cpuplugd.conf
%config /boot/zipl/active_devices.txt
%dir %attr(2770,root,ts-shell) /var/log/ts-shell
%dir /etc/cmsfs-fuse
++++++ cputype ++++++
--- /var/tmp/diff_new_pack.25NRop/_old 2017-11-14 12:42:06.796107490 +0100
+++ /var/tmp/diff_new_pack.25NRop/_new 2017-11-14 12:42:06.796107490 +0100
@@ -2,7 +2,7 @@
#
# cputype
#
-# Copyright (c) 2014-2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2014-2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# Based on the IBM machine model, returns a (hopefully) human understandable
# string that identifies the processor.
@@ -58,6 +58,7 @@
2828) echo "${machine} = z12-BC IBM zEnterprise BC12" ;;
2964) echo "${machine} = z13 IBM z13" ;;
2965) echo "${machine} = z13s IBM z13s (single frame)" ;;
+ 3906) echo "${machine} = z14 IBM z14" ;;
*) echo "An unknown machine type was reported: ${machine}" >&2
echo "Please file a bug report with this output:" >&2
/bin/cat /proc/cpuinfo >&2
++++++ ctc_configure ++++++
--- /var/tmp/diff_new_pack.25NRop/_old 2017-11-14 12:42:06.816106759 +0100
+++ /var/tmp/diff_new_pack.25NRop/_new 2017-11-14 12:42:06.816106759 +0100
@@ -2,316 +2,127 @@
#
# ctc_configure
#
-# Configures a CTC device
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+#
+# Configures a CTC device 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.
#
# Usage:
# ctc_configure <read channel> <write channel> <online> [<protocol>]
#
# read/write channel = x.y.ssss where
-# x is always 0 until IBM creates something that uses that number
-# 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.
+# x is always 0 until IBM creates something that
+# uses that number
+# 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.
# online = 0 to take the device offline
# 1 to bring the device online
-# protocol = 0 Compatibility with peers other than OS/390®, or z/OS, for example, a z/VM TCP service machine. This is the default.
+# protocol = 0 Compatibility with peers other than OS/390®, or z/OS, for
+# example, a z/VM TCP service machine. This is the default.
# 1 Enhanced package checking for Linux peers.
# 3 For compatibility with OS/390 or z/OS peers.
-# 4 For MPC connections to VTAM on traditional mainframe operating systems.
+# 4 For MPC connections to VTAM on traditional mainframe
+# operating systems.
#
# Return values:
-# 1 sysfs not mounted
-# 2 Invalid status for <online>
-# 3 No device found for read-channel
-# 4 No device found for write-channel
-# 5 Invalid device type
-# 6 Device type mismatch
-# 7 Could not load module
-# 8 CCW devices grouped different devices
-# 9 Could not group devices
-# 10 Could not set device online
-# 11 Could not set device offline
+# Return codes are determined by the chzdev command.
#
-if [ "${DEBUG}" != "yes" ]; then
- DEBUG="no"
-fi
-
-DATUM=$(date)
-
-add_channel_for_cio() {
- echo "$* # $DATUM" >> /boot/zipl/active_devices.txt
-}
-
-remove_channel_for_cio() {
- [ -w /boot/zipl/active_devices.txt ] && sed -i -e "/^$1/d" /boot/zipl/active_devices.txt
-}
-
mesg () {
echo "$@"
}
debug_mesg () {
- case "$DEBUG" in
- yes) mesg "$@" ;;
- *) ;;
+ case "${DEBUG}" in
+ yes) mesg "$@" ;;
+ *) ;;
esac
}
-# Get the mount point for sysfs
-while read MNTPT MNTDIR MNTSYS MNTTYPE; do
- if test "$MNTSYS" = "sysfs"; then
- SYSFS="$MNTDIR"
- break;
- fi
-done > /boot/zipl/active_devices.txt
+}
-debug_mesg "Configuring CTC/LCS device ${CTC_READ_CHAN}/${CTC_WRITE_CHAN}"
+remove_cio_channel() {
+ [ -w /boot/zipl/active_devices.txt ] && sed -i -e "/^${1}/d" /boot/zipl/active_devices.txt
+}
+usage(){
+ echo "Usage: ${0} <read channel> <write channel> <online> [<protocol>]"
+ echo " read/write channel = x.y.ssss where"
+ echo " x is always 0 until IBM creates something that"
+ echo " uses that number"
+ echo " y is the logical channel subsystem (lcss) number."
+ echo " Most often this is 0, but it could be non-zero"
+ echo " ssss is the four digit subchannel address of the"
+ echo " device, in hexidecimal, with leading zeros."
+ echo " online = 0 to take the device offline"
+ echo " 1 to bring the device online"
+ echo " protocol = 0 Compatibility with peers other than OS/390®, or z/OS, for"
+ echo " example, a z/VM TCP service machine. This is the default."
+ echo " 1 Enhanced package checking for Linux peers."
+ echo " 3 For compatibility with OS/390 or z/OS peers."
+ echo " 4 For MPC connections to VTAM on traditional mainframe"
+ echo " operating systems."
+}
-if test ! -d "$_ccw_dir/$CTC_READ_CHAN" ; then
- mesg "device $_ccw_dir/$CTC_READ_CHAN does not exist"
- exit 3
-fi
-if test ! -d "$_ccw_dir/$CTC_WRITE_CHAN" ; then
- mesg "device $_ccw_dir/$CTC_WRITE_CHAN does not exist"
- exit 4
+if [ "${DEBUG}" != "yes" ]; then
+ DEBUG="no"
fi
-CCW_CHAN_GROUP=
-for ccw in $_ccw_dir/$CTC_READ_CHAN $_ccw_dir/$CTC_WRITE_CHAN; do
+DATE=$(date)
- read _cu_type < $ccw/cutype
- read _dev_type < $ccw/devtype
-
- case "$_cu_type" in
- 3088/01)
- # P/390 network adapter
- CCW_CHAN_NAME="cu3088"
- CCW_CHAN_GROUP="lcs"
- ;;
- 3088/08)
- # Channel To Channel
- CCW_CHAN_NAME="cu3088"
- CCW_CHAN_GROUP="ctcm"
- ;;
- 3088/1e)
- # FICON adapter
- CCW_CHAN_NAME="cu3088"
- CCW_CHAN_GROUP="ctcm"
- ;;
- 3088/1f)
- # ESCON adapter (I.e. hardware CTC device)
- CCW_CHAN_NAME="cu3088"
- CCW_CHAN_GROUP="ctcm"
- ;;
- 3088/60)
- # Lan Channel Station
- CCW_CHAN_NAME="cu3088"
- CCW_CHAN_GROUP="lcs"
- ;;
- *)
- CCW_CHAN_NAME=
- ;;
- esac
+CTC_READ_CHAN=${1}
+CTC_WRITE_CHAN=${2}
+ON_OFF=${3}
+CTC_MODE=${4}
- if [ -z "$CCW_CHAN_NAME" ]; then
- mesg "Not a valid CTC device (cu $_cutype, dev $_devtype)"
- exit 5
- fi
-
- [ -z "$tmp_chan" ] && tmp_chan=$CCW_CHAN_GROUP
-done
-
-if [ "$tmp_chan" != "$CCW_CHAN_GROUP" ] ; then
- mesg "CTC type mismatch (read: $tmp_chan, write: $CCW_CHAN_GROUP)"
- exit 6
+if [ -z "${CTC_READ_CHAN}" ] || [ -z "${CTC_WRITE_CHAN}" ] || [ -z "${ON_OFF}" ]; then
+ mesg "You didn't specify all the needed parameters."
+ usage
+ exit 1
fi
-_ccw_groupdir=${SYSFS}/bus/ccwgroup
-
-# Check for modules
-if test ! -d "${_ccw_groupdir}/drivers/${CCW_CHAN_GROUP}" ; then
- /sbin/modprobe $CCW_CHAN_GROUP
-
- # Re-check whether module loading has succeeded
- if test ! -d "${_ccw_groupdir}/drivers/${CCW_CHAN_GROUP}"; then
- mesg "Could not load module ${CCW_CHAN_GROUP}"
- exit 7
- fi
+if [ -z "${CTC_MODE}" ]; then
+ PARM_LIST="${PARM_LIST} protocol=0"
+else PARM_LIST="${PARM_LIST} protocol=${CTC_MODE}"
fi
-# Check for grouping
-_ccw_status_dir=
-if [ -e ${_ccw_dir}/${CTC_READ_CHAN}/group_device ] ; then
- _ccw_status_dir=$(cd -P ${_ccw_dir}/${CTC_READ_CHAN}/group_device; echo $PWD)
-fi
-if [ -e ${_ccw_dir}/${CTC_WRITE_CHAN}/group_device ] ; then
- _tmp_status_dir=$(cd -P ${_ccw_dir}/${CTC_READ_CHAN}/group_device; echo $PWD)
- if [ "$_ccw_status_dir" ] && [ "$_ccw_status_dir" != "$_tmp_status_dir" ] ; then
- mesg "CCW devices grouped to different devices"
- exit 8
- fi
- _ccw_status_dir=$_tmp_status_dir
-fi
-#
-# Addresses are free (but may be bound to the wrong driver)
-#
-_ccw_drivers=${SYSFS}/bus/ccw/drivers
-for i in ${CTC_READ_CHAN} ${CTC_WRITE_CHAN}
- do
- if [ "$CCW_CHAN_GROUP" = "lcs" ]
- then
- if [ -e "${_ccw_drivers}/ctcm/${i}" ] ; then
- echo $i > ${_ccw_drivers}/ctcm/unbind
- fi
- if [ ! -e "${_ccw_drivers}/lcs/${i}" ] ; then
- echo $i > ${_ccw_drivers}/ctcm/bind
- fi
- else
- if [ -e "${_ccw_drivers}/lcs/${i}" ] ; then
- echo $i > ${_ccw_drivers}/lcs/unbind
- fi
- if [ ! -e "${_ccw_drivers}/ctcm/${i}" ] ; then
- echo $i > ${_ccw_drivers}/ctcm/bind
- fi
- fi
- done
-
-debug_mesg "Group is ${_ccw_groupdir}/drivers/${CCW_CHAN_GROUP}/group"
-if [ -z "$_ccw_status_dir" ] ; then
- echo "$CTC_READ_CHAN,$CTC_WRITE_CHAN" > ${_ccw_groupdir}/drivers/${CCW_CHAN_GROUP}/group
- if [ -e ${_ccw_dir}/${CTC_READ_CHAN}/group_device ] ; then
- _ccw_status_dir=$(cd -P ${_ccw_dir}/${CTC_READ_CHAN}/group_device; echo $PWD)
- 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."
+ mesg "Check to see if sysfs is mounted."
+ exit 1
fi
-if [ -z "$_ccw_status_dir" -o ! -e "$_ccw_status_dir" ] ; then
- mesg "Could not group $CCW_CHAN_GROUP devices $CTC_READ_CHAN/$CTC_WRITE_CHAN"
- exit 9
+if [ "${CU_TYPE}" == "3088/01" ] || [ "${CU_TYPE}" == "3088/60" ]; then
+ DEV_TYPE="lcs"
+else DEV_TYPE="ctc"
fi
-CCW_CHAN_ID=${_ccw_status_dir##*/}
-
-read _ccw_dev_status < $_ccw_status_dir/online
-
-if [ "$ONLINE" -eq 1 ]; then
- # Check whether we need to do something
- if [ "$_ccw_dev_status" -eq 0 ]; then
- if [ "$CTC_MODE" -gt 0 -a "$CCW_CHAN_GROUP" != "lcs" ]; then
- echo $CTC_MODE > $_ccw_status_dir/protocol
- fi
- # Set the device online
- debug_mesg "Setting device online"
- echo "1" > $_ccw_status_dir/online
- # Re-read device status
- read _ccw_dev_status < $_ccw_status_dir/online
- if [ "$_ccw_dev_status" -eq 0 ]; then
- mesg "Could not set device ${CCW_CHAN_ID} online"
- exit 10
- fi
- else
- debug_mesg "Device ${CCW_CHAN_ID} is already online"
- fi
-else
- if [ "$_ccw_dev_status" -eq 1 ]; then
- # Set the device offline
- debug_mesg "Setting device offline"
- echo "$ONLINE" > $_ccw_status_dir/online
-
- # Re-read to check whether we have succeeded
- _ccw_dev_status=$(cat $_ccw_status_dir/online)
- if [ "$_ccw_dev_status" -ne "$ONLINE" ]; then
- mesg "Could not set device ${CCW_CHAN_ID} offline"
- exit 11
- fi
- else
- debug_mesg "Device ${CCW_CHAN_ID} is already offline"
- fi
- # Always reset CTC Protocol
- if [ "$CCW_CHAN_GROUP" != "lcs" ]; then
- echo 0 > $_ccw_status_dir/protocol
- fi
+if [ "${ON_OFF}" == 0 ]; then
+ debug_mesg "chzdev -d ${DEV_TYPE} ${CTC_READ_CHAN}"
+ chzdev -d ${DEV_TYPE} ${CTC_READ_CHAN}
+elif [ "${ON_OFF}" == 1 ]; then
+ debug_mesg "chzdev -e ${DEV_TYPE} ${CTC_READ_CHAN} ${PARM_LIST}"
+ chzdev -e ${DEV_TYPE} ${CTC_READ_CHAN} ${PARM_LIST}
+else mesg "You must specify a 0 or a 1 for the online/offline attribute."
+ usage
+ exit 1
fi
-RULES_DIR=/etc/udev/rules.d
-RULES_FILE=51-${CCW_CHAN_GROUP}-${CCW_CHAN_ID}.rules
+RC=${?}
+if [ ${RC} -ne 0 ]; then
+ exit ${RC}
+fi
-if [ -d "$RULES_DIR" ]; then
- if [ -f ${RULES_DIR}/${RULES_FILE} ]; then
- rm -f ${RULES_DIR}/${RULES_FILE}
- fi
- remove_channel_for_cio "$CTC_READ_CHAN"
- remove_channel_for_cio "$CTC_WRITE_CHAN"
-
- if [ "$ONLINE" -eq "1" ]; then
- add_channel_for_cio "$CTC_READ_CHAN,$CTC_WRITE_CHAN"
- # Write a new udev rules file
- cat > ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} < ] <ccwid> <online> [use_diag]
#
-# -f force creation of udev rules, do not check values in /sys.
-# -t DASD type. Must be provided if -f is used.
+# -f Override safety checks
+# -t DASD type. Must be provided if -f is used. Only dasd-eckd and
+# dasd-fba are supported - Deprecated
# ccwid = x.y.ssss where
# x is always 0 until IBM creates something that uses that number
-# 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.
+# 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.
# online = 0 to take the device offline
# 1 to bring the device online
# use_diag = 0 to _not_ use z/VM DIAG250 I/O, which is the default
# 1 to use z/VM DIAG250 I/O
#
# Return values:
-# 1 If the "Usage:" line is displayed, not enough parameters specified.
-# 1 sysfs not mounted (if the "Usage:" line is not displayed).
-# 2 Invalid status for <online>
-# 3 No device found for <ccwid>
-# 4 Could not change state of the device
-# 5 Device is not a DASD
-# 6 Could not load module
-# 7 Failed to activate DASD
-# 8 DASD not formatted
-# 9 Only dasd-fba or dasd-eckd is supported.
+# Return codes are determined by the chzdev command.
#
-if [ "${DEBUG}" != "yes" ]; then
- DEBUG="no"
-fi
-
-exitcode=0
-DASD_FORCE=0
-DASD_TYPE="unknown"
-
-DATUM=$(date)
-
-add_channel_for_cio() {
- echo "$* # $DATUM" >> /boot/zipl/active_devices.txt
-}
-
-remove_channel_for_cio() {
- [ -w /boot/zipl/active_devices.txt ] && sed -i -e "/^$1/d" /boot/zipl/active_devices.txt
-}
-
mesg () {
echo "$@"
}
debug_mesg () {
- case "$DEBUG" in
+ case "${DEBUG}" in
yes) mesg "$@" ;;
*) ;;
esac
}
-if [ $# -lt 2 ] ; then
- echo "Usage: $0 [options] <ccwid> <online> [use_diag]"
- echo
- echo " -f force creation of udev rules, do not check values in /sys."
- echo " -t DASD type. Must be provided if -f is used."
- 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 this is 0, but it could be non-zero"
- echo " ssss is the four digit subchannel address of the device, in hexidecimal, with leading zeros."
- echo " online = 0 to take the device offline"
- echo " 1 to bring the device online"
- echo " use_diag = 0 to _not_ use z/VM DIAG250 I/O, which is the default"
- echo " 1 to use z/VM DIAG250 I/O"
- exit 1
-fi
+add_cio_channel() {
+ echo "$* # ${DATE}" >> /boot/zipl/active_devices.txt
+}
-while [ $# -gt 0 ] ; do
- case "$1" in
- -f) # force creation of udev rules, do not check values in /sys
- DASD_FORCE=1
- ;;
- -t*) # drive type. Must be provided if -f is used.
- if [ "$1" = "-t" ] ; then
- if [ "$2" = "dasd-eckd" -o "$2" = "dasd-fba" ]; then
- DASD_TYPE=$2
- shift
- else
- debug_mesg "Only dasd-eckd or dasd-fba are supported."
- exit 9
- fi
- fi
- ;;
- *)
- break;
- ;;
- esac
- shift
-done
+remove_cio_channel() {
+ [ -w /boot/zipl/active_devices.txt ] && sed -i -e "/^${1}/d" /boot/zipl/active_devices.txt
+}
-if [ $DASD_FORCE -eq 0 ]; then
- # Get the mount point for sysfs
- while read MNTPT MNTDIR MNTSYS MNTTYPE; do
- if test "$MNTSYS" = "sysfs"; then
- SYSFS="$MNTDIR"
- break;
- fi
- done ] <ccwid> <online> [use_diag]"
+ echo
+ echo " -f Override safety checks"
+ echo " -t DASD type. Must be provided if -f is used. Only dasd-eckd and"
+ echo " dasd-fba are supported - Deprecated"
+ 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"
+ echo " use_diag = 0 to _not_ use z/VM DIAG250 I/O, which is the default"
+ echo " 1 to use z/VM DIAG250 I/O"
+}
-CCW_CHAN_ID=$1
-ONLINE=$2
-USE_DIAG=$3
-
-[ -z "$USE_DIAG" ] && USE_DIAG=0
-
-if [ -z "$ONLINE" ] || [ "$ONLINE" -ne "1" -a "$ONLINE" -ne "0" ]; then
- mesg "Invalid device status $ONLINE"
- mesg "It must be a zero or a one."
- exit 2
+if [ "${DEBUG}" != "yes" ]; then
+ DEBUG="no"
fi
-if [ $DASD_FORCE -eq 0 ]; then
- _ccw_dir=${SYSFS}/bus/ccw/devices
+DATE=$(date)
+
+DASD_FORCE=0
- debug_mesg "Configuring device ${CCW_CHAN_ID}"
- _ccw_status_dir="$_ccw_dir/$CCW_CHAN_ID"
+############################################################
+# Parse the parameters from the command line
+#
+ARGS=$(getopt --options ft: -n "dasd_configure" -- "$@")
+if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
- if test ! -d "$_ccw_status_dir" ; then
- if test "$ONLINE" -eq 1 ; then
- mesg "No device ${CCW_CHAN_ID}"
- exit 3
- fi
- _ccw_dev_status=0
- else
- read _cu_type < $_ccw_status_dir/cutype
- read _dev_type < $_ccw_status_dir/devtype
-
- case "$_cu_type" in
- 3990/*|2105/*|2107/*|1750/*|9343/*)
- CCW_CHAN_NAME="dasd-eckd"
- MODULE=dasd_eckd_mod
- DISCIPLINE=ECKD
- ;;
- 6310/*)
- CCW_CHAN_NAME="dasd-fba"
- MODULE=dasd_fba_mod
- DISCIPLINE=FBA
- ;;
- 3880/*)
- case "$_dev_type" in
- 3390/*)
- CCW_CHAN_NAME="dasd-eckd"
- MODULE=dasd_eckd_mod
- DISCIPLINE=ECKD
- ;;
- 3370/*)
- CCW_CHAN_NAME="dasd-fba"
- MODULE=dasd_fba_mod
- DISCIPLINE=FBA
- ;;
- *)
- CCW_CHAN_NAME=
- ;;
- esac
- ;;
- *)
- CCW_CHAN_NAME=
- ;;
- esac
-
- if [ -z "$CCW_CHAN_NAME" ]; then
- mesg "Not a DASD device (cu $_cutype, dev $_devtype)"
- exit 5
- fi
-
- # Check for modules
- if test ! -d "${SYSFS}/bus/ccw/drivers/${CCW_CHAN_NAME}" ; then
- /sbin/modprobe $MODULE
-
- # Re-check whether module loading has succeeded
- if test ! -d "${SYSFS}/bus/ccw/drivers/${CCW_CHAN_NAME}"; then
- mesg "Could not load module ${MODULE}"
- exit 6
- fi
- fi
-
- read _ccw_dev_status < $_ccw_status_dir/online
- fi # if test ! -d "$_ccw_status_dir"
-
- #
- # We check whether we are running under z/VM by looking for the string
- # "Control Program: z/VM" in /proc/sysinfo
- #
- /bin/grep "Control Program: z/VM" /proc/sysinfo 2>&1 > /dev/null
- if [ -x /sbin/vmcp -a $? -eq 0 ]; then
- # Unconditionally load the vmcp module, loader might be broken
- [ -x /sbin/modprobe ] && /sbin/modprobe -q vmcp
- # Wait until udev is settled
- [ -x /sbin/udevadm ] && /sbin/udevadm settle --timeout=30
-
- # Check read-only status of virtual DASDs from z/VM
- if /sbin/vmcp q v dasd > /dasd_attr.lst 2> /dev/null; then
- while read x dev type label attr1 attr2 rest; do
- dev=`echo $dev|tr A-F a-f`
- if test "$type" = "ON"; then
- attr="$attr2"
- else
- attr="$attr1"
- fi
- if [ "$CCW_CHAN_ID" = "0.0.$dev" ]; then
- if test "$attr" = "R/O"; then
- _ccw_use_readonly="1"
- fi
- fi
- done < /dasd_attr.lst
- fi
- rm -f /dasd_attr.lst
- fi # if [ -x /sbin/vmcp -a $? -eq 0 ]
-
- if [ "$ONLINE" -eq 1 ]; then
- # Check whether we need to do something
- read _ccw_use_diag < $_ccw_status_dir/use_diag
-
- if [ "$_ccw_use_diag" -ne "$USE_DIAG" ] &&
- [ "$_ccw_dev_status" -eq 1 ] ; then
- # We need to change the DIAG access mode
- # so we have to set the device offline first
- debug_mesg "Setting device offline for DIAG access"
- echo "0" > $_ccw_status_dir/online
- # Re-read device status
- read _ccw_dev_status < $_ccw_status_dir/online
- if [ "$_ccw_dev_status" -ne 0 ]; then
- mesg "Could not set the device offline for DIAG access"
- exit 4
- fi
- fi
-
- if [ "$_ccw_dev_status" -eq 0 ]; then
- # Set readonly access if detected
- if [ "$_ccw_use_readonly" ]; then
- debug_mesg "Setting device read-only"
- echo 1 > $_ccw_status_dir/readonly
- fi
-
- if [ "$USE_DIAG" -eq 1 ]; then
- # Load the diag module if possible
- [ -x /sbin/modprobe ] && /sbin/modprobe -q dasd_diag_mod
- _has_dasd_diag=$(/bin/sed -n '/^dasd_diag_mod/p' /proc/modules)
- if [ "$_has_dasd_diag" ]; then
- # DIAG mode is special:
- # We can only be sure if DIAG is available
- # _after_ we have activated the device
- debug_mesg "Activating DIAG access mode"
- echo "$USE_DIAG" > $_ccw_status_dir/use_diag
- read _ccw_use_diag < $_ccw_status_dir/use_diag
- # Set the device online
- debug_mesg "Setting device online"
- echo "1" > $_ccw_status_dir/online 2>/dev/null
- # Re-read device status
- read _ccw_dev_status < $_ccw_status_dir/online
- if [ "$_ccw_dev_status" -eq 0 ]; then
- mesg "Could not activate DIAG access mode for device ${CCW_CHAN_ID}"
- USE_DIAG=0
- echo "$USE_DIAG" > $_ccw_status_dir/use_diag
- # Set the device online
- debug_mesg "Setting device online"
- echo "1" > $_ccw_status_dir/online
- else
- MODULE=dasd_diag_mod
- fi
- else
- debug_mesg "DIAG mode not available"
- USE_DIAG=0
- # Set the device online
- debug_mesg "Setting device online"
- echo "1" > $_ccw_status_dir/online
- fi # if [ "$_has_dasd_diag" ];
- else
- if [ "$_ccw_use_diag" -eq 1 ] ; then
- debug_mesg "Deactivating DIAG access mode"
- echo "0" > $_ccw_status_dir/use_diag
- read _ccw_use_diag < $_ccw_status_dir/use_diag
- fi
- # Set the device online
- debug_mesg "Setting device online"
- echo "1" > $_ccw_status_dir/online
- fi # if [ "$USE_DIAG" -eq 1 ]
-
- # Re-read device status
- read _ccw_dev_status < $_ccw_status_dir/online
- if [ "$_ccw_dev_status" -eq 0 ]; then
- mesg "Could not set device ${CCW_CHAN_ID} online"
- exit 4
- fi
-
- # Wait for the device to come online
- read _dasd_state < $_ccw_status_dir/status
- i=0
- while [ "$_dasd_state" != "online" ] ; do
- if [ "$_dasd_state" = "unformatted" ] ; then
- mesg "Device ${CCW_CHAN_ID} is unformatted"
- exitcode=8
- break
- fi
- [ $i -gt 30 ] && break
- i=$(expr $i + 1)
- sleep .1
- read _dasd_state < $_ccw_status_dir/status
- done
- else
- debug_mesg "Device ${CCW_CHAN_ID} is already online"
- fi # if [ "$_ccw_dev_status" -eq 0 ]
-
- read _dasd_state < $_ccw_status_dir/status
- if [ "$_dasd_state" != "online" ] && [ "$_dasd_state" != "unformatted" ] ; then
- mesg "Failed to activate device ${CCW_CHAN_ID}, device in state $_dasd_state"
- exit 7
- fi
- else
- if [ "$_ccw_dev_status" -eq 1 ]; then
- # Set the device offline
- debug_mesg "Setting device offline"
- echo "$ONLINE" > $_ccw_status_dir/online
-
- # Re-read to check whether we have succeeded
- _ccw_dev_status=$(cat $_ccw_status_dir/online)
- if [ "$?" -ne 0 -o "$_ccw_dev_status" -ne "$ONLINE" ]; then
- mesg "Could not set device ${CCW_CHAN_ID} offline"
- exit 4
- fi
- else
- debug_mesg "Device ${CCW_CHAN_ID} is already offline"
- fi
-
- if [ -d "$_ccw_status_dir" ] ; then
- # Always disabling DIAG access
- echo "0" > $_ccw_status_dir/use_diag
- fi
-
- # Set readonly access if detected
- if [ "$_ccw_use_readonly" ]; then
- debug_mesg "Setting device read-only"
- echo 1 > $_ccw_status_dir/readonly
- fi
- fi # if [ "$ONLINE" -eq 1 ]
-
- # Wait until udev is settled
- [ -x /sbin/udevadm ] && /sbin/udevadm settle --timeout=30
-
-fi # Second instance of if [ $DASD_FORCE -eq 0 ]
-
-if [ $DEBUG = "no" ]; then
- RULES_DIR=/etc/udev/rules.d
-else
- RULES_DIR=.
+eval set -- "${ARGS}"
+debug_mesg "All the parms passed were ${ARGS}"
+
+while true; do
+ case "${1}" in
+ -f) debug_mesg "This used to mean udev rules will always be generated."
+ debug_mesg "For chzdev, it means safety checks will be overridden."
+ debug_mesg "Kinda sorta the same thing, really."
+ PARM_LIST="${PARM_LIST} -f"
+ DASD_FORCE=1
+ shift 1
+ ;;
+ -t) debug_mesg "This used to set the card type to ${2}"
+ debug_mesg "Now it gets ignored."
+ shift 2
+ ;;
+ --) debug_mesg "Found the end of parms indicator: --"
+ shift 1
+ break
+ ;;
+ *) debug_mesg "At the catch-all select entry"
+ debug_mesg "What was selected was ${1}"
+ shift 1
+ ;;
+ esac
+done
+
+CCW_CHAN_ID=${1}
+ON_OFF=${2}
+USE_DIAG=${3}
+
+if [ -z "${CCW_CHAN_ID}" ] || [ -z "${ON_OFF}" ]; then
+ mesg "You didn't specify all the needed parameters."
+ usage
+ exit 1
fi
-RULES_FILE=51-dasd-${CCW_CHAN_ID}.rules
+if [ -n "${USE_DIAG}" ]; then
+ PARM_LIST="${PARM_LIST} use_diag=${USE_DIAG}"
+else PARM_LIST="${PARM_LIST} use_diag=0"
+fi
-if [ -d "$RULES_DIR" ]; then
- if [ -f ${RULES_DIR}/${RULES_FILE} ]; then
- rm -f ${RULES_DIR}/${RULES_FILE}
- fi
- remove_channel_for_cio "${CCW_CHAN_ID}"
-
- if [ "$ONLINE" -eq "1" ]; then
- add_channel_for_cio "${CCW_CHAN_ID}"
- # Write a new hwcfg file
- cat > ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <> /boot/zipl/active_devices.txt
-}
-
-remove_channel_for_cio() {
- [ -w /boot/zipl/active_devices.txt ] && sed -i -e "/^$1/d" /boot/zipl/active_devices.txt
-}
-
debug_mesg () {
- case "$DEBUG" in
- yes) mesg "$@" ;;
- *) ;;
+ case "${DEBUG}" in
+ yes) mesg "$@" ;;
+ *) ;;
esac
}
-while [ $# -gt 0 ] ; do
- case "$1" in
- -i)
- # Configure IP takeover
- QETH_IPA_TAKEOVER=1
- ;;
- -f) # force creation of udev rules, do not check values in /sys
- QETH_FORCE=1
- ;;
- -l)
- # Configure Layer2 support
- QETH_LAYER2_SUPPORT=1
- ;;
- -n*)
- # QETH port number to use
- if [ "$1" = "-n" ] ; then
- QETH_PORTNO=$2
- shift
- else
- QETH_PORTNO=${1#-n}
- fi
- ;;
- -o)
- # General QETH options, separated by spaces
- QETH_OPTIONS=$2
- shift
- ;;
- -p*)
- # QETH Portname to use
- if [ "$1" = "-p" ] ; then
- QETH_PORTNAME=$2
- shift
- else
- QETH_PORTNAME=${1#-p}
- fi
- ;;
- -t*) # Card type. Must be provided if -f is used.
- if [ "$1" = "-t" ] ; then
- if [ "$2" = "qeth" -o "$2" = "hsi" -o "$2" = "osn" ]; then
- QETH_CARD=$2
- shift
- else
- mesg "Only qeth, hsi and osn are supported."
- exit 6
- fi
- fi
- CCW_DRV="$QETH_CARD"
- ;;
- *)
- break;
- ;;
- esac
- shift
-done
-
-if [ $QETH_FORCE -eq 0 ]; then
-# Get the mount point for sysfs
- while read MNTPT MNTDIR MNTSYS MNTTYPE; do
- if test "$MNTSYS" = "sysfs"; then
- SYSFS="$MNTDIR"
- break;
- fi
- done > /boot/zipl/active_devices.txt
+}
-debug_mesg "Configuring QETH device ${QETH_READ_CHAN}/${QETH_WRITE_CHAN}/${QETH_DATA_CHAN}"
+remove_cio_channel() {
+ [ -w /boot/zipl/active_devices.txt ] && sed -i -e "/^${1}/d" /boot/zipl/active_devices.txt
+}
+usage(){
+ echo "Usage: ${0} [options] <read chan> <write chan> <data chan> <online>"
+ echo " -i Configure IP takeover"
+ echo " -l Configure Layer2 support"
+ echo " -f Override safety checks"
+ echo " -t Valid cardtypes are: qeth, hsi - Deprecated."
+ echo " -o General QETH options, separated by spaces"
+ echo " -n QETH port number to use, 0 or 1. Only needed for real, not virtual"
+ echo " devices."
+ echo " -p QETH Portname to use - Deprecated. OSAs no longer need a port name."
+ echo " read/write/data chan = x.y.ssss where"
+ echo " x is always 0 until IBM creates something that"
+ echo " uses that number"
+ echo " y is the logical channel subsystem (lcss)"
+ echo " number. Most often this is 0, but it could"
+ echo " be non-zero"
+ echo " ssss is the four digit subchannel address of"
+ echo " the device, in hexidecimal, with leading"
+ echo " zeros."
+ echo " online = 0 to take the device offline"
+ echo " 1 to bring the device online"
+}
-if test ! -d "$_ccw_dir/$QETH_READ_CHAN" ; then
- mesg "No device ${QETH_READ_CHAN}"
- exit 3
-fi
-if test ! -d "$_ccw_dir/$QETH_WRITE_CHAN" ; then
- mesg "No device ${QETH_WRITE_CHAN}"
- exit 4
-fi
-if test ! -d "$_ccw_dir/$QETH_DATA_CHAN" ; then
- mesg "No device ${QETH_DATA_CHAN}"
- exit 5
+if [ "${DEBUG}" != "yes" ]; then
+ DEBUG="no"
fi
-CCW_CHAN_GROUP=
-for ccw in $_ccw_dir/$QETH_READ_CHAN $_ccw_dir/$QETH_WRITE_CHAN $_ccw_dir/$QETH_DATA_CHAN; do
+DATE=$(date)
- read _cu_type < $ccw/cutype
- read _dev_type < $ccw/devtype
-
- case "$_cu_type" in
- 1731/01|1731/02)
- # OSA/Express / Guest LAN
- CCW_DRV="qeth"
- QETH_CARD="qeth"
- ;;
- 1731/05)
- # Hipersockets
- CCW_DRV="qeth"
- QETH_CARD="hsi"
- ;;
- 1731/06)
- # OSA/N
- CCW_DRV="qeth"
- QETH_CARD="osn"
- ;;
- *)
- CCW_DRV=
- ;;
- esac
+############################################################
+# Parse the parameters from the command line
+#
+ARGS=$(getopt --options ifln:o:p:t: -n "qeth_configure" -- "$@")
+if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
- if [ -z "$CCW_DRV" ]; then
- mesg "Not a valid QETH device (cu $_cutype, dev $_devtype)"
- exit 6
- fi
+eval set -- "${ARGS}"
+debug_mesg "All the parms passed were ${ARGS}"
+
+# Set some defaults
+LAYER_MODE="layer2=0"
+
+while true; do
+ case "${1}" in
+ -i) debug_mesg "Configure IP takeover"
+ PARM_LIST="${PARM_LIST} ipa_takeover/enable=1"
+ shift 1
+ ;;
+ -f) debug_mesg "This used to mean udev rules will always be generated."
+ debug_mesg "For chzdev, it means safety checks will be overridden."
+ debug_mesg "Kinda sorta the same thing, really."
+ PARM_LIST="${PARM_LIST} -f"
+ shift 1
+ ;;
+ -l) debug_mesg "Configure Layer 2 support"
+ LAYER_MODE="layer2=1"
+ shift 1
+ ;;
+ -n) debug_mesg "Set QETH port number to ${2}"
+ PARM_LIST="${PARM_LIST} portno=${2}"
+ shift 2
+ ;;
+ -o) debug_mesg "Add the following arbitrary parms: ${2}"
+ PARM_LIST="${PARM_LIST} ${2}"
+ shift 2
+ ;;
+ -p) debug_mesg "QETH Port name is no longer used, don't specify it: ${2}"
+ shift 2
+ ;;
+ -t) debug_mesg "This used to set the card type to ${2}"
+ debug_mesg "Now it gets ignored."
+ shift 2
+ ;;
+ --) debug_mesg "Found the end of parms indicator: --"
+ shift 1
+ break
+ ;;
+ *) debug_mesg "At the catch-all select entry"
+ debug_mesg "What was selected was ${1}"
+ shift 1
+ ;;
+ esac
done
-fi # end QETH_FORCE
-
-# Portname is only required for OSA/Express
-if [ -n "$QETH_PORTNAME" -a "$QETH_CARD" != "qeth" ] ; then
- debug_mesg "No portname required for $QETH_CARD adapters"
- QETH_PORTNAME=
-fi
-if [ $QETH_FORCE -eq 0 ]; then
-_ccw_groupdir=${SYSFS}/bus/ccwgroup
-
-# Check for modules
-if test ! -d "${_ccw_groupdir}/drivers/${CCW_DRV}" ; then
- /sbin/modprobe $CCW_DRV
-
- # Re-check whether module loading has succeeded
- if test ! -d "${_ccw_groupdir}/drivers/${CCW_DRV}"; then
- mesg "Could not load module ${CCW_DRV}"
- exit 7
- fi
-fi
-
-# Check for grouping
-_ccwgroup_dir=
-if [ -e ${_ccw_dir}/${QETH_READ_CHAN}/group_device ] ; then
- _ccwgroup_dir=$(cd -P ${_ccw_dir}/${QETH_READ_CHAN}/group_device; echo $PWD)
-fi
-if [ -e ${_ccw_dir}/${QETH_WRITE_CHAN}/group_device ] ; then
- _tmp_status_dir=$(cd -P ${_ccw_dir}/${QETH_READ_CHAN}/group_device; echo $PWD)
- if [ "$_ccwgroup_dir" ] && [ "$_ccwgroup_dir" != "$_tmp_status_dir" ] ; then
- mesg "CCW devices grouped to different devices"
- exit 8
- fi
- _ccwgroup_dir=$_tmp_status_dir
-fi
-if [ -e ${_ccw_dir}/${QETH_DATA_CHAN}/group_device ] ; then
- _tmp_status_dir=$(cd -P ${_ccw_dir}/${QETH_DATA_CHAN}/group_device; echo $PWD)
- if [ "$_ccwgroup_dir" ] && [ "$_ccwgroup_dir" != "$_tmp_status_dir" ] ; then
- mesg "CCW devices grouped to different devices"
- exit 8
- fi
- _ccwgroup_dir=$_tmp_status_dir
-fi
-if [ -z "$_ccwgroup_dir" ] ; then
- echo "$QETH_READ_CHAN,$QETH_WRITE_CHAN,$QETH_DATA_CHAN" > ${_ccw_groupdir}/drivers/${CCW_DRV}/group
- if [ -e ${_ccw_dir}/${QETH_READ_CHAN}/group_device ] ; then
- _ccwgroup_dir=$(cd -P ${_ccw_dir}/${QETH_READ_CHAN}/group_device; echo $PWD)
- fi
+QETH_READ_CHAN=${1}
+QETH_WRITE_CHAN=${2}
+QETH_DATA_CHAN=${3}
+ON_OFF=${4}
+
+if [ -z "${QETH_READ_CHAN}" ] || [ -z "${QETH_WRITE_CHAN}" ] || [ -z "${QETH_DATA_CHAN}" ] || [ -z "${ON_OFF}" ]; then
+ mesg "You didn't specify all the needed parameters."
+ usage
+ exit 1
+fi
+
+if [ "${ON_OFF}" == 0 ]; then
+ debug_mesg "chzdev -d qeth ${QETH_READ_CHAN}"
+ chzdev -d qeth ${QETH_READ_CHAN}
+elif [ "${ON_OFF}" == 1 ]; then
+ debug_mesg "chzdev -e qeth ${LAYER_MODE} ${PARM_LIST} ${QETH_READ_CHAN}"
+ chzdev -e qeth ${LAYER_MODE} ${PARM_LIST} ${QETH_READ_CHAN}
+else mesg "You must specify a 0 or a 1 for the online/offline attribute."
+ usage
+ exit 1
+fi
+
+RC=${?}
+if [ ${RC} -ne 0 ]; then
+ exit ${RC}
+fi
+
+if [ ${ON_OFF} == 1 ]; then
+ add_cio_channel "${QETH_READ_CHAN},${QETH_WRITE_CHAN},${QETH_DATA_CHAN}"
+else remove_cio_channel "${QETH_READ_CHAN}"
+ remove_cio_channel "${QETH_WRITE_CHAN}"
+ remove_cio_channel "${QETH_DATA_CHAN}"
fi
-
-if [ -z "$_ccwgroup_dir" -o ! -e "$_ccwgroup_dir" ] ; then
- mesg "Could not group $CCW_DRV devices $QETH_READ_CHAN/$QETH_WRITE_CHAN/$QETH_DATA_CHAN"
- exit 9
-fi
-
-CCW_CHAN_ID=${_ccwgroup_dir##*/}
-
-read _online < $_ccwgroup_dir/online
-
-if [ "$ONLINE" -eq 1 ]; then
- # Check whether we need to do something
- # We do not check for the value of CCW_CHAN_MODE, since we
- # might want to switch back and forth between several modes
- if test "$_online" -eq "0" ; then
- # Set the portname
- if [ "$QETH_PORTNAME" ]; then
- mesg "(portname $QETH_PORTNAME) "
- echo "$QETH_PORTNAME" > $_ccwgroup_dir/portname
- fi
- # Activate Layer2 support
- if [ -w "$_ccwgroup_dir/layer2" ] ; then
- if [ "$QETH_LAYER2_SUPPORT" = "1" ]; then
- mesg "(Layer2) "
- echo 1 > $_ccwgroup_dir/layer2
- else
- echo 0 > $_ccwgroup_dir/layer2
- fi
- else
- QETH_LAYER2_SUPPORT=
- fi
- # Enable IP address takeover
- if [ "$QETH_IPA_TAKEOVER" ]; then
- if [ "$QETH_IPA_TAKEOVER" = "1" ]; then
- mesg "(IP takeover) "
- echo 1 > $_ccwgroup_dir/ipa_takeover/enable
- fi
- fi
- # Relative port number
- if [ -w "$_ccwgroup_dir/portno" ] ; then
- if [ -n "$QETH_PORTNO" ]; then
- mesg "(Port $QETH_PORTNO) "
- # This may fail, but trial and error is the only way to tell.
- echo "$QETH_PORTNO" > $_ccwgroup_dir/portno
- fi
- else
- unset QETH_PORTNO
- fi
- # Set additional options
- if [ "$QETH_OPTIONS" ]; then
- for opt in $QETH_OPTIONS; do
- set -- $(IFS='='; echo $opt)
- opt_name=$1
- opt_val=$2
- case "$opt_name" in
- portname|ipa_takeover|layer2)
- # These options are set above
- debug_mesg "Invalid option $opt_name"
- ;;
- *)
- if [ "$opt_name" -a "$opt_val" ]; then
- if [ -w "$_ccwgroup_dir/$opt_name" ]; then
- mesg "($opt_name) "
- echo "$opt_val" > $_ccwgroup_dir/$opt_name
- if [ $? -eq 0 ] ; then
- cur_opts="$cur_opts ${opt_name}=${opt_val}"
- fi
- else
- # Skip invalid options
- debug_mesg "Invalid option $opt_name"
- fi
- fi
- ;;
- esac
- done
- # Update options list
- QETH_OPTIONS="$cur_opts"
- fi
-
- echo "1" > $_ccwgroup_dir/online 2> /dev/null
- # Re-read device status
- read _ccw_dev_status < $_ccwgroup_dir/online
- if [ "$_ccw_dev_status" -eq 0 ]; then
- mesg "Could not set device ${CCW_CHAN_ID} online"
- exit 10
- fi
- else
- debug_mesg "Device ${CCW_CHAN_ID} is already online"
- fi
-else
- if [ "$_online" -eq 1 ]; then
- # Set the device offline
- debug_mesg "Setting device offline"
- echo "$ONLINE" > $_ccwgroup_dir/online
-
- # Re-read to check whether we have succeeded
- _online=$(cat $_ccwgroup_dir/online)
- if [ "$_online" -ne "$ONLINE" ]; then
- mesg "Could not set device ${CCW_CHAN_ID} offline"
- exit 11
- fi
- else
- debug_mesg "Device ${CCW_CHAN_ID} is already offline"
- fi
- echo 1 > $_ccwgroup_dir/ungroup
-fi
-else
- CCW_CHAN_ID=$QETH_READ_CHAN
-fi # QETH_FORCE
-
-if [ $DEBUG = "no" ]; then
- RULES_DIR=/etc/udev/rules.d
-else
- RULES_DIR=.
-fi
-
-RULES_FILE=51-${QETH_CARD}-${CCW_CHAN_ID}.rules
-
-if [ -d "$RULES_DIR" ]; then
- if [ -f ${RULES_DIR}/${RULES_FILE} ]; then
- rm -f ${RULES_DIR}/${RULES_FILE}
- fi
- remove_channel_for_cio "${QETH_READ_CHAN}"
- remove_channel_for_cio "${QETH_WRITE_CHAN}"
- remove_channel_for_cio "${QETH_DATA_CHAN}"
-
- if [ "$ONLINE" -eq "1" ]; then
- add_channel_for_cio "${QETH_READ_CHAN},${QETH_WRITE_CHAN},${QETH_DATA_CHAN}"
- # Write a new udev rules file
- cat > ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <
From a060dc22db06fb14274b72984ae8db51f00a21cd Mon Sep 17 00:00:00 2001
From: Peter Oberparleiter
Date: Mon, 13 Nov 2017 12:50:32 +0100
Subject: [PATCH] zdev: Use correct path to vmcp binary
The zdev tools use a hard-coded path to locate the vmcp binary. Since
this path may differ between distributions, the vmcp binary may not be
successfully located in all cases. Fix this by using the BINDIR macro
to determine the correct path. This macro is also used during
installation of the vmcp binary itself.
Reviewed-by: Michael Holzheu
Signed-off-by: Peter Oberparleiter
Signed-off-by: Michael Holzheu
---
common.mak | 2 ++
include/lib/zt_common.h | 1 +
zdev/include/path.h | 2 +-
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/common.mak b/common.mak
index b9a9f54..bb6cdf0 100644
--- a/common.mak
+++ b/common.mak
@@ -194,12 +194,14 @@ ALL_CFLAGS = -DS390_TOOLS_RELEASE=$(S390_TOOLS_RELEASE) \
-DS390_TOOLS_LIBDIR=$(TOOLS_LIBDIR) \
-DS390_TOOLS_DATADIR=$(TOOLS_DATADIR) \
-DS390_TOOLS_SYSCONFDIR=$(SYSCONFDIR) \
+ -DS390_TOOLS_BINDIR=$(BINDIR) \
$(CFLAGS)
CXXFLAGS ?= $(DEFAULT_CFLAGS) $(OPT_FLAGS)
ALL_CXXFLAGS = -DS390_TOOLS_RELEASE=$(S390_TOOLS_RELEASE) \
-DS390_TOOLS_LIBDIR=$(TOOLS_LIBDIR) \
-DS390_TOOLS_DATADIR=$(TOOLS_DATADIR) \
-DS390_TOOLS_SYSCONFDIR=$(SYSCONFDIR) \
+ -DS390_TOOLS_BINDIR=$(BINDIR) \
$(CXXFLAGS)
ALL_CPPFLAGS = -I $(rootdir)include $(CPPFLAGS)
ALL_LDFLAGS = $(LDFLAGS)
diff --git a/include/lib/zt_common.h b/include/lib/zt_common.h
index e27b7b0..c486428 100644
--- a/include/lib/zt_common.h
+++ b/include/lib/zt_common.h
@@ -25,6 +25,7 @@
#define RELEASE_STRING STRINGIFY (S390_TOOLS_RELEASE)
#define TOOLS_LIBDIR STRINGIFY (S390_TOOLS_LIBDIR)
#define TOOLS_SYSCONFDIR STRINGIFY (S390_TOOLS_SYSCONFDIR)
+#define TOOLS_BINDIR STRINGIFY (S390_TOOLS_BINDIR)
#define __noreturn __attribute__((noreturn))
#define __packed __attribute__((packed))
diff --git a/zdev/include/path.h b/zdev/include/path.h
index 5252bcf..536ca06 100644
--- a/zdev/include/path.h
+++ b/zdev/include/path.h
@@ -27,7 +27,7 @@
#define PATH_PROC "/proc"
#define PATH_UDEVADM "udevadm"
-#define PATH_VMCP "/usr/sbin/vmcp"
+#define PATH_VMCP TOOLS_BINDIR "/vmcp"
#define PATH_IP "ip"
#define PATH_ROOT "/"
--
2.13.6
++++++ zfcp_disk_configure ++++++
--- /var/tmp/diff_new_pack.25NRop/_old 2017-11-14 12:42:07.160094176 +0100
+++ /var/tmp/diff_new_pack.25NRop/_new 2017-11-14 12:42:07.164094030 +0100
@@ -2,318 +2,72 @@
#
# zfcp_disk_configure
#
-# Configures a zfcp disk
+# 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.
#
# 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
-# 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.
+# 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.
# online = 0 to take the device offline
# 1 to bring the device online
#
-# Return codes
-# 1 sysfs not mounted
-# 2 invalid value for <online>
-# 3 device <ccwid> does not exist
-# 4 WWPN invalid
-# 5 Could not activate WWPN for adapter
-# 6 Could not activate zFCP disk
-# 7 SCSI disk could not be deactivated
-# 8 zFCP LUN could not be deregistered
-# 9 zFCP WWPN could not be deregistered
+# Return values:
+# Return codes are determined by the chzdev command.
#
-if [ "${DEBUG}" != "yes" ]; then
- DEBUG="no"
-fi
-
mesg () {
echo "$@"
}
debug_mesg () {
- case "$DEBUG" in
- yes) mesg "$@" ;;
- *) ;;
+ case "${DEBUG}" in
+ yes) mesg "$@" ;;
+ *) ;;
esac
}
-if [ $# -ne 4 ] ; then
- 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 this is 0, but it could be non-zero"
- echo " ssss is the four digit subchannel address of the device, in hexidecimal, with leading zeros."
- echo " online = 0 to take the device offline"
- echo " 1 to bring the device online"
- exit 1
-fi
-
-# Get the mount point for sysfs
-while read MNTPT MNTDIR MNTSYS MNTTYPE; do
- if test "$MNTSYS" = "sysfs"; then
- SYSFS="$MNTDIR"
- break;
- fi
-done ${_zfcp_wwpn_dir}/unit_add
- /sbin/udevadm settle
- fi
- # Re-check whether the disk could be activated
- if [ ! -d "${_zfcp_wwpn_dir}/0x${FCP_LUN}" ] ; then
- mesg "Could not activate FCP disk ${FCP_WWPN}:${FCP_LUN}"
- exit 6
- fi
- # Check for failed disks
- read wwpn_status < ${_zfcp_wwpn_dir}/0x${FCP_LUN}/status
- while [ "$wwpn_status" != 0 ] ; do
- sleep 1
- read wwpn_status < ${_zfcp_wwpn_dir}/0x${FCP_LUN}/in_recovery
- [ "$wwpn_status" = 0 ] && break
- done
- read wwpn_status < ${_zfcp_wwpn_dir}/0x${FCP_LUN}/failed
- if [ "$wwpn_status" = 1 ] ; then
- debug_mesg "ERP failed on FCP disk ${FCP_WWPN}:${FCP_LUN}"
- exit 7
- fi
- fi
-else
- # Deconfigure SCSI disk
- debug_mesg "Deconfiguring FCP disk ${FCP_WWPN}:${FCP_LUN}"
-
- _zfcp_wwpn_dir="${_zfcp_dir}/0x${FCP_WWPN}"
- # Find the correspondig SCSI disk
- for host_dir in $_zfcp_dir/host*; do
- if [ -d $host_dir ] ; then
- _zfcp_scsi_host_dir=$host_dir
- break;
- fi
- done
- if [ -d "$_zfcp_scsi_host_dir" ] ; then
- # Deregister the disk from SCSI layer
- for target in $_zfcp_scsi_host_dir/rport-*/target*/* ; do
- [ "$target" != "${target##*/fc_transport}" ] && continue
- if [ -d "$target" ] && [ -d "$target/scsi_device" ] ; then
- _zfcp_scsi_id=${target##*/}
- read _zfcp_tmp_hba < ${target}/hba_id
- read _zfcp_tmp_wwpn < ${target}/wwpn
- read _zfcp_tmp_lun < ${target}/fcp_lun
- if [ "0x${FCP_LUN}" = "$_zfcp_tmp_lun" -a "0x${FCP_WWPN}" = "$_zfcp_tmp_wwpn" ] ; then
- if [ "$auto_lun_scan" = 1 ] ; then
- mesg "Could not deactivate SCSI disk ${_zfcp_scsi_id}"
- exit 7
- else
- echo 1 > $target/delete
- _zfcp_scsi_dir=$target
- fi
- break;
- fi
- fi
- done
- /sbin/udevadm settle
- else
- debug_mesg "No SCSI disk found for FCP disk ${FCP_WWPN}:${FCP_LUN}"
- fi
-
- # Re-check whether the SCSI disk is gone
- num=$udev_timeout
- while [ $num -gt 0 ] ; do
- [ -d "${_zfcp_scsi_dir}" ] || break
- let num=$num-1
- sleep 1
- done
- if [ -d "${_zfcp_scsi_dir}" ]; then
- mesg "Could not deactivate SCSI disk ${_zfcp_scsi_id}"
- exit 7
- fi
-
- # Wait for udev to catch up
- /sbin/udevadm settle
-
- # check multipathing
- _zfcp_scsi_dev=$(multipathd -k'show paths' 2> /dev/null | sed -n "s/$_zfcp_scsi_id \(sd[a-z]*\).*/\1/p")
- [ "$_zfcp_scsi_dev" ] && multipathd -k"del path $_zfcp_scsi_dev"
-
- # Deconfigure the FCP_LUN
- : ${_zfcp_wwpn_dir}
- echo "0x${FCP_LUN}" > ${_zfcp_wwpn_dir}/unit_remove
- if [ -d "${_zfcp_wwpn_dir}/0x${FCP_LUN}" ]; then
- mesg "Could not deregister FCP LUN ${FCP_LUN}"
- exit 8
- fi
-
- # Find all remaining activated disks
- ZFCP_LUNS=
- for _tmp_wwpn_dir in ${_zfcp_dir}/0x*; do
- if [ -d "$_tmp_wwpn_dir" ]; then
- tmp_wwpn=$(basename $_tmp_wwpn_dir)
- # Find all luns
- for _tmp_lun_dir in ${_tmp_wwpn_dir}/0x*; do
- if [ -d "$_tmp_lun_dir" ]; then
- tmp_lun=$(basename $_tmp_lun_dir)
- tmp_port="${tmp_wwpn}:${tmp_lun}"
- ZFCP_LUNS="$ZFCP_LUNS
-$tmp_port"
- fi
- done
- fi
- done
-fi
-
-# And now update the rules file
-if test -d ${RULES_DIR}; then
- # Find all WWPNs
-
- read online < ${_zfcp_dir}/online;
- if [ $online -eq 0 ] ; then
- exit 0
- fi
-
- for port in ${_zfcp_dir}/0x* ; do
- [ -d $port ] || continue;
- [ -w $port/unit_remove ] || continue;
- port_list="$port_list ${port##*/}"
- done
-
- cat > ${RULES_DIR}/${RULES_FILE} <> ${RULES_DIR}/${RULES_FILE} <> /boot/zipl/active_devices.txt
-}
-
-remove_channel_for_cio() {
- [ -w /boot/zipl/active_devices.txt ] && sed -i -e "/^$1/d" /boot/zipl/active_devices.txt
-}
-
mesg () {
echo "$@"
}
debug_mesg () {
- case "$DEBUG" in
- yes) mesg "$@" ;;
- *) ;;
+ case "${DEBUG}" in
+ yes) mesg "$@" ;;
+ *) ;;
esac
}
-if [ $# -ne 2 ] ; then
- echo "Usage: $0 <ccwid> <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 this is 0, but it could be non-zero"
- echo " ssss is the four digit subchannel address of the device, in hexidecimal, with leading zeros."
- echo " online = 0 to take the device offline"
- echo " 1 to bring the device online"
- exit 1
-fi
+add_cio_channel() {
+ echo "$* # ${DATE}" >> /boot/zipl/active_devices.txt
+}
-# Get the mount point for sysfs
-while read MNTPT MNTDIR MNTSYS MNTTYPE; do
- if test "$MNTSYS" = "sysfs"; then
- SYSFS="$MNTDIR"
- break;
- fi
-done $_zfcp_dir/online
-
- # Now wait for the adapter to initialize
- /sbin/udevadm settle
- fi
-
- for loop in 1 2 3 4 5 ; do
- read status < /sys/bus/ccw/devices/$CCW_CHAN_ID/status
- (( $status & 0x10000000 )) && break;
- done
- read wwpn_status < /sys/bus/ccw/devices/$CCW_CHAN_ID/status
- if !(( $wwpn_status & 0x10000000 )) ; then
- echo 0 > /sys/bus/ccw/devices/$CCW_CHAN_ID/online
- mesg "Could not activate adapter, status $wwpn_status"
- exit 5
- fi
-
- # Write the configuration file
- if test -d ${RULES_DIR}; then
- cat > ${RULES_DIR}/${RULES_FILE} < ${_zfcp_dir}/online
- # Re-read to check whether we have succeeded
- _ccw_dev_status=$(cat $_zfcp_dir/online)
- if [ "$_ccw_dev_status" -ne "$ONLINE" ]; then
- mesg "Could not change status of device ${CCW_CHAN_ID} to $ONLINE"
- exit 5
- fi
- echo "${CCW_CHAN_ID}" > /sys/bus/ccw/drivers/zfcp/unbind
- echo "${CCW_CHAN_ID}" > /sys/bus/ccw/drivers/zfcp/bind
- remove_channel_for_cio "${CCW_CHAN_ID}"
-
- debug_mesg "zFCP adapter at ${CCW_CHAN_ID} deactivated"
+if [ ${ON_OFF} == 1 ]; then
+ add_cio_channel "${CCW_CHAN_ID}"
+else remove_cio_channel "${CCW_CHAN_ID}"
fi
-
-# EOF