|
|
712866 |
From 49a23aa4261a896303d7923d5c94c9840739022f Mon Sep 17 00:00:00 2001
|
|
|
712866 |
From: Harald Hoyer <harald@redhat.com>
|
|
|
712866 |
Date: Fri, 12 Sep 2014 09:57:13 +0200
|
|
|
712866 |
Subject: [PATCH] cms/cmssetup.sh: fixed indention
|
|
|
712866 |
|
|
|
712866 |
(cherry picked from commit d68163551226d302677e358e721560d8d651a30f)
|
|
|
712866 |
---
|
|
|
712866 |
modules.d/80cms/cmssetup.sh | 260 ++++++++++++++++++++++----------------------
|
|
|
712866 |
1 file changed, 130 insertions(+), 130 deletions(-)
|
|
|
712866 |
|
|
|
712866 |
diff --git a/modules.d/80cms/cmssetup.sh b/modules.d/80cms/cmssetup.sh
|
|
|
5c6c2a |
index c9e13314..7dd481b5 100755
|
|
|
712866 |
--- a/modules.d/80cms/cmssetup.sh
|
|
|
712866 |
+++ b/modules.d/80cms/cmssetup.sh
|
|
|
712866 |
@@ -44,147 +44,147 @@ function dasd_settle() {
|
|
|
712866 |
}
|
|
|
712866 |
|
|
|
712866 |
function dasd_settle_all() {
|
|
|
712866 |
- for dasdccw in $(while read line; do echo ${line%%(*}; done < /proc/dasd/devices) ; do
|
|
|
712866 |
+ for dasdccw in $(while read line; do echo "${line%%(*}"; done < /proc/dasd/devices) ; do
|
|
|
712866 |
if ! dasd_settle $dasdccw ; then
|
|
|
712866 |
echo $"Could not access DASD $dasdccw in time"
|
|
|
712866 |
return 1
|
|
|
712866 |
fi
|
|
|
712866 |
done
|
|
|
712866 |
return 0
|
|
|
712866 |
- }
|
|
|
712866 |
+}
|
|
|
712866 |
|
|
|
712866 |
# prints a canonocalized device bus ID for a given devno of any format
|
|
|
712866 |
- function canonicalize_devno()
|
|
|
712866 |
- {
|
|
|
712866 |
- case ${#1} in
|
|
|
712866 |
- 3) echo "0.0.0${1}" ;;
|
|
|
712866 |
- 4) echo "0.0.${1}" ;;
|
|
|
712866 |
- *) echo "${1}" ;;
|
|
|
712866 |
- esac
|
|
|
712866 |
- return 0
|
|
|
712866 |
- }
|
|
|
712866 |
+function canonicalize_devno()
|
|
|
712866 |
+{
|
|
|
712866 |
+ case ${#1} in
|
|
|
712866 |
+ 3) echo "0.0.0${1}" ;;
|
|
|
712866 |
+ 4) echo "0.0.${1}" ;;
|
|
|
712866 |
+ *) echo "${1}" ;;
|
|
|
712866 |
+ esac
|
|
|
712866 |
+ return 0
|
|
|
712866 |
+}
|
|
|
712866 |
|
|
|
712866 |
# read file from CMS and write it to /tmp
|
|
|
712866 |
- function readcmsfile() # $1=dasdport $2=filename
|
|
|
712866 |
- {
|
|
|
712866 |
- local dev
|
|
|
712866 |
- local numcpus
|
|
|
712866 |
- local devname
|
|
|
712866 |
- local ret=0
|
|
|
712866 |
- if [ $# -ne 2 ]; then return; fi
|
|
|
712866 |
+function readcmsfile() # $1=dasdport $2=filename
|
|
|
712866 |
+{
|
|
|
712866 |
+ local dev
|
|
|
712866 |
+ local numcpus
|
|
|
712866 |
+ local devname
|
|
|
712866 |
+ local ret=0
|
|
|
712866 |
+ if [ $# -ne 2 ]; then return; fi
|
|
|
712866 |
# precondition: udevd created dasda block device node
|
|
|
712866 |
- if ! dasd_cio_free -d $1 ; then
|
|
|
712866 |
- echo $"DASD $1 could not be cleared from device blacklist"
|
|
|
712866 |
- return 1
|
|
|
712866 |
- fi
|
|
|
712866 |
+ if ! dasd_cio_free -d $1 ; then
|
|
|
712866 |
+ echo $"DASD $1 could not be cleared from device blacklist"
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+ fi
|
|
|
712866 |
|
|
|
712866 |
- modprobe dasd_mod dasd=$CMSDASD
|
|
|
712866 |
- modprobe dasd_eckd_mod
|
|
|
712866 |
- udevadm settle
|
|
|
712866 |
+ modprobe dasd_mod dasd=$CMSDASD
|
|
|
712866 |
+ modprobe dasd_eckd_mod
|
|
|
712866 |
+ udevadm settle
|
|
|
712866 |
|
|
|
712866 |
# precondition: dasd_eckd_mod driver incl. dependencies loaded,
|
|
|
712866 |
# dasd_mod must be loaded without setting any DASD online
|
|
|
712866 |
- dev=$(canonicalize_devno $1)
|
|
|
712866 |
- numcpus=$(
|
|
|
712866 |
- while read line; do
|
|
|
712866 |
- if strstr "$line" "# processors"; then
|
|
|
712866 |
- echo ${line##*:};
|
|
|
712866 |
- break;
|
|
|
712866 |
- fi;
|
|
|
712866 |
- done < /proc/cpuinfo
|
|
|
712866 |
- )
|
|
|
712866 |
-
|
|
|
712866 |
- if [ ${numcpus} -eq 1 ]; then
|
|
|
712866 |
- echo 1 > /sys/bus/ccw/devices/$dev/online
|
|
|
712866 |
- else
|
|
|
712866 |
- if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
|
|
712866 |
- echo $"DASD $dev could not be set online"
|
|
|
712866 |
- return 1
|
|
|
712866 |
- fi
|
|
|
712866 |
- udevadm settle
|
|
|
712866 |
- if ! dasd_settle $dev ; then
|
|
|
712866 |
- echo $"Could not access DASD $dev in time"
|
|
|
712866 |
- return 1
|
|
|
712866 |
- fi
|
|
|
712866 |
+ dev=$(canonicalize_devno $1)
|
|
|
712866 |
+ numcpus=$(
|
|
|
712866 |
+ while read line; do
|
|
|
712866 |
+ if strstr "$line" "# processors"; then
|
|
|
712866 |
+ echo ${line##*:};
|
|
|
712866 |
+ break;
|
|
|
712866 |
+ fi;
|
|
|
712866 |
+ done < /proc/cpuinfo
|
|
|
712866 |
+ )
|
|
|
712866 |
+
|
|
|
712866 |
+ if [ ${numcpus} -eq 1 ]; then
|
|
|
712866 |
+ echo 1 > /sys/bus/ccw/devices/$dev/online
|
|
|
712866 |
+ else
|
|
|
712866 |
+ if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then
|
|
|
712866 |
+ echo $"DASD $dev could not be set online"
|
|
|
712866 |
+ return 1
|
|
|
712866 |
fi
|
|
|
712866 |
-
|
|
|
712866 |
udevadm settle
|
|
|
712866 |
+ if ! dasd_settle $dev ; then
|
|
|
712866 |
+ echo $"Could not access DASD $dev in time"
|
|
|
712866 |
+ return 1
|
|
|
712866 |
+ fi
|
|
|
712866 |
+ fi
|
|
|
712866 |
|
|
|
712866 |
- devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
|
|
712866 |
- devname=${devname:-dasda}
|
|
|
712866 |
+ udevadm settle
|
|
|
712866 |
|
|
|
712866 |
- [[ -d /mnt ]] || mkdir /mnt
|
|
|
712866 |
- if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
|
|
712866 |
- cat /mnt/$2 > /run/initramfs/$2
|
|
|
712866 |
- umount /mnt || umount -l /mnt
|
|
|
712866 |
- udevadm settle
|
|
|
712866 |
- else
|
|
|
712866 |
- echo $"Could not read conf file $2 on CMS DASD $1."
|
|
|
712866 |
- ret=1
|
|
|
712866 |
- fi
|
|
|
712866 |
+ devname=$(cd /sys/bus/ccw/devices/$dev/block; set -- *; [ -b /dev/$1 ] && echo $1)
|
|
|
712866 |
+ devname=${devname:-dasda}
|
|
|
712866 |
|
|
|
712866 |
- if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
|
|
712866 |
- echo $"DASD $dev could not be set offline again"
|
|
|
712866 |
- #return 1
|
|
|
712866 |
- fi
|
|
|
712866 |
+ [[ -d /mnt ]] || mkdir /mnt
|
|
|
712866 |
+ if cmsfs-fuse --to=UTF-8 -a /dev/$devname /mnt; then
|
|
|
712866 |
+ cat /mnt/$2 > /run/initramfs/$2
|
|
|
712866 |
+ umount /mnt || umount -l /mnt
|
|
|
712866 |
udevadm settle
|
|
|
712866 |
+ else
|
|
|
712866 |
+ echo $"Could not read conf file $2 on CMS DASD $1."
|
|
|
712866 |
+ ret=1
|
|
|
712866 |
+ fi
|
|
|
712866 |
+
|
|
|
712866 |
+ if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then
|
|
|
712866 |
+ echo $"DASD $dev could not be set offline again"
|
|
|
712866 |
+ #return 1
|
|
|
712866 |
+ fi
|
|
|
712866 |
+ udevadm settle
|
|
|
712866 |
|
|
|
712866 |
# unbind all dasds to unload the dasd modules for a clean start
|
|
|
712866 |
- ( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
|
|
712866 |
- udevadm settle
|
|
|
712866 |
- modprobe -r dasd_eckd_mod
|
|
|
712866 |
- udevadm settle
|
|
|
712866 |
- modprobe -r dasd_diag_mod
|
|
|
712866 |
- udevadm settle
|
|
|
712866 |
- modprobe -r dasd_mod
|
|
|
712866 |
- udevadm settle
|
|
|
712866 |
- return $ret
|
|
|
712866 |
- }
|
|
|
712866 |
-
|
|
|
712866 |
- processcmsfile()
|
|
|
712866 |
- {
|
|
|
712866 |
- source /tmp/cms.conf
|
|
|
712866 |
- SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
|
|
712866 |
-
|
|
|
712866 |
- if [[ $NETTYPE ]]; then
|
|
|
712866 |
- (
|
|
|
712866 |
- echo -n $NETTYPE,$SUBCHANNELS
|
|
|
712866 |
- [[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
|
|
712866 |
- [[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
|
|
712866 |
- [[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
|
|
712866 |
- echo
|
|
|
712866 |
- ) >> /etc/ccw.conf
|
|
|
712866 |
-
|
|
|
712866 |
- OLDIFS=$IFS
|
|
|
712866 |
- IFS=,
|
|
|
712866 |
- read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
|
|
712866 |
- IFS=$OLDIFS
|
|
|
712866 |
- devbusid=${subch_array[1]}
|
|
|
712866 |
- if [ "$NETTYPE" = "ctc" ]; then
|
|
|
712866 |
- driver="ctcm"
|
|
|
712866 |
- else
|
|
|
712866 |
- driver=$NETTYPE
|
|
|
712866 |
- fi
|
|
|
712866 |
-
|
|
|
712866 |
- printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
|
|
712866 |
- # remove the default net rules
|
|
|
712866 |
- rm -f -- /etc/udev/rules.d/91-default-net.rules
|
|
|
712866 |
- [[ -f /etc/udev/rules.d/90-net.rules ]] \
|
|
|
712866 |
- || printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
|
|
712866 |
- udevadm control --reload
|
|
|
712866 |
- znet_cio_free
|
|
|
712866 |
- fi
|
|
|
712866 |
+ ( cd /sys/bus/ccw/drivers/dasd-eckd; for i in *.*; do echo $i > unbind;done)
|
|
|
712866 |
+ udevadm settle
|
|
|
712866 |
+ modprobe -r dasd_eckd_mod
|
|
|
712866 |
+ udevadm settle
|
|
|
712866 |
+ modprobe -r dasd_diag_mod
|
|
|
712866 |
+ udevadm settle
|
|
|
712866 |
+ modprobe -r dasd_mod
|
|
|
712866 |
+ udevadm settle
|
|
|
712866 |
+ return $ret
|
|
|
712866 |
+}
|
|
|
712866 |
|
|
|
712866 |
- if [[ $DASD ]]; then
|
|
|
712866 |
- echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
|
|
712866 |
- echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
|
|
712866 |
- dasd_cio_free
|
|
|
712866 |
+processcmsfile()
|
|
|
712866 |
+{
|
|
|
712866 |
+ source /tmp/cms.conf
|
|
|
712866 |
+ SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')"
|
|
|
712866 |
+
|
|
|
712866 |
+ if [[ $NETTYPE ]]; then
|
|
|
712866 |
+ (
|
|
|
712866 |
+ echo -n $NETTYPE,$SUBCHANNELS
|
|
|
712866 |
+ [[ $PORTNAME ]] && echo -n ",portname=$PORTNAME"
|
|
|
712866 |
+ [[ $LAYER2 ]] && echo -n ",layer2=$LAYER2"
|
|
|
712866 |
+ [[ "$NETTYPE" = "ctc" ]] && [[ $CTCPROT ]] && echo -n ",protocol=$CTCPROT"
|
|
|
712866 |
+ echo
|
|
|
712866 |
+ ) >> /etc/ccw.conf
|
|
|
712866 |
+
|
|
|
712866 |
+ OLDIFS=$IFS
|
|
|
712866 |
+ IFS=,
|
|
|
712866 |
+ read -a subch_array <<< "indexzero,$SUBCHANNELS"
|
|
|
712866 |
+ IFS=$OLDIFS
|
|
|
712866 |
+ devbusid=${subch_array[1]}
|
|
|
712866 |
+ if [ "$NETTYPE" = "ctc" ]; then
|
|
|
712866 |
+ driver="ctcm"
|
|
|
712866 |
+ else
|
|
|
712866 |
+ driver=$NETTYPE
|
|
|
712866 |
fi
|
|
|
712866 |
|
|
|
712866 |
- unset _do_zfcp
|
|
|
712866 |
- for i in ${!FCP_*}; do
|
|
|
712866 |
- echo "${!i}" | while read port rest; do
|
|
|
712866 |
- case $port in
|
|
|
712866 |
+ printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
|
|
712866 |
+ # remove the default net rules
|
|
|
712866 |
+ rm -f -- /etc/udev/rules.d/91-default-net.rules
|
|
|
712866 |
+ [[ -f /etc/udev/rules.d/90-net.rules ]] \
|
|
|
712866 |
+ || printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
|
|
712866 |
+ udevadm control --reload
|
|
|
712866 |
+ znet_cio_free
|
|
|
712866 |
+ fi
|
|
|
712866 |
+
|
|
|
712866 |
+ if [[ $DASD ]]; then
|
|
|
712866 |
+ echo $DASD | normalize_dasd_arg > /etc/dasd.conf
|
|
|
712866 |
+ echo "options dasd_mod dasd=$DASD" > /etc/modprobe.d/dasd_mod.conf
|
|
|
712866 |
+ dasd_cio_free
|
|
|
712866 |
+ fi
|
|
|
712866 |
+
|
|
|
712866 |
+ unset _do_zfcp
|
|
|
712866 |
+ for i in ${!FCP_*}; do
|
|
|
712866 |
+ echo "${!i}" | while read port rest; do
|
|
|
712866 |
+ case $port in
|
|
|
712866 |
*.*.*)
|
|
|
712866 |
;;
|
|
|
712866 |
*.*)
|
|
|
712866 |
@@ -193,23 +193,23 @@ function dasd_settle_all() {
|
|
|
712866 |
*)
|
|
|
712866 |
port="0.0.$port"
|
|
|
712866 |
;;
|
|
|
712866 |
- esac
|
|
|
712866 |
- echo $port $rest >> /etc/zfcp.conf
|
|
|
712866 |
- done
|
|
|
712866 |
- _do_zfcp=1
|
|
|
712866 |
+ esac
|
|
|
712866 |
+ echo $port $rest >> /etc/zfcp.conf
|
|
|
712866 |
done
|
|
|
712866 |
- [[ $_do_zfcp ]] && zfcp_cio_free
|
|
|
712866 |
- unset _do_zfcp
|
|
|
712866 |
- }
|
|
|
712866 |
+ _do_zfcp=1
|
|
|
712866 |
+ done
|
|
|
712866 |
+ [[ $_do_zfcp ]] && zfcp_cio_free
|
|
|
712866 |
+ unset _do_zfcp
|
|
|
712866 |
+}
|
|
|
712866 |
|
|
|
712866 |
- [[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
|
|
712866 |
- [[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
|
|
712866 |
+[[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
|
|
|
712866 |
+[[ $CMSCONFFILE ]] || CMSCONFFILE=$(getarg "CMSCONFFILE=")
|
|
|
712866 |
|
|
|
712866 |
# Parse configuration
|
|
|
712866 |
- if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
|
|
712866 |
- if readcmsfile $CMSDASD $CMSCONFFILE; then
|
|
|
712866 |
- ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
|
|
712866 |
- ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
|
|
712866 |
- processcmsfile
|
|
|
712866 |
- fi
|
|
|
712866 |
+if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then
|
|
|
712866 |
+ if readcmsfile $CMSDASD $CMSCONFFILE; then
|
|
|
712866 |
+ ln -s /run/initramfs/$CMSCONFFILE /tmp/$CMSCONFFILE
|
|
|
712866 |
+ ln -s /run/initramfs/$CMSCONFFILE /tmp/cms.conf
|
|
|
712866 |
+ processcmsfile
|
|
|
712866 |
fi
|
|
|
712866 |
+fi
|