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