|
Harald Hoyer |
4734ec |
From d6f0467edf3895143713eab579f48df2be140178 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
4734ec |
From: Hannes Reinecke <hare@suse.de>
|
|
Harald Hoyer |
4734ec |
Date: Fri, 29 Nov 2013 13:13:48 +0100
|
|
Harald Hoyer |
4734ec |
Subject: [PATCH] Add zfcp scripts for SUSE
|
|
Harald Hoyer |
4734ec |
|
|
Harald Hoyer |
4734ec |
SuSE is storing the zfcp configuration in udev files, so we should
|
|
Harald Hoyer |
4734ec |
be including these.
|
|
Harald Hoyer |
4734ec |
|
|
Harald Hoyer |
4734ec |
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
|
Harald Hoyer |
4734ec |
---
|
|
Harald Hoyer |
4734ec |
modules.d/95zfcp_rules/module-setup.sh | 25 +++++++++++++
|
|
Harald Hoyer |
4734ec |
modules.d/95zfcp_rules/parse-zfcp.sh | 65 ++++++++++++++++++++++++++++++++++
|
|
Harald Hoyer |
4734ec |
2 files changed, 90 insertions(+)
|
|
Harald Hoyer |
4734ec |
create mode 100755 modules.d/95zfcp_rules/module-setup.sh
|
|
Harald Hoyer |
4734ec |
create mode 100755 modules.d/95zfcp_rules/parse-zfcp.sh
|
|
Harald Hoyer |
4734ec |
|
|
Harald Hoyer |
4734ec |
diff --git a/modules.d/95zfcp_rules/module-setup.sh b/modules.d/95zfcp_rules/module-setup.sh
|
|
Harald Hoyer |
4734ec |
new file mode 100755
|
|
Harald Hoyer |
4734ec |
index 0000000..9a1ab20
|
|
Harald Hoyer |
4734ec |
--- /dev/null
|
|
Harald Hoyer |
4734ec |
+++ b/modules.d/95zfcp_rules/module-setup.sh
|
|
Harald Hoyer |
4734ec |
@@ -0,0 +1,25 @@
|
|
Harald Hoyer |
4734ec |
+#!/bin/bash
|
|
Harald Hoyer |
4734ec |
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
Harald Hoyer |
4734ec |
+# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
Harald Hoyer |
4734ec |
+
|
|
Harald Hoyer |
4734ec |
+# called by dracut
|
|
Harald Hoyer |
4734ec |
+check() {
|
|
Harald Hoyer |
4734ec |
+ local _arch=$(uname -m)
|
|
Harald Hoyer |
4734ec |
+ [ -x /sbin/zfcp_disk_configure ] || return 1
|
|
Harald Hoyer |
4734ec |
+ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
|
|
Harald Hoyer |
4734ec |
+ return 0
|
|
Harald Hoyer |
4734ec |
+}
|
|
Harald Hoyer |
4734ec |
+
|
|
Harald Hoyer |
4734ec |
+# called by dracut
|
|
Harald Hoyer |
4734ec |
+depends() {
|
|
Harald Hoyer |
4734ec |
+ return 0
|
|
Harald Hoyer |
4734ec |
+}
|
|
Harald Hoyer |
4734ec |
+
|
|
Harald Hoyer |
4734ec |
+# called by dracut
|
|
Harald Hoyer |
4734ec |
+install() {
|
|
Harald Hoyer |
4734ec |
+ inst_multiple /usr/lib/udev/collect
|
|
Harald Hoyer |
4734ec |
+ inst_hook cmdline 30 "$moddir/parse-zfcp.sh"
|
|
Harald Hoyer |
4734ec |
+ if [[ $hostonly ]] ; then
|
|
Harald Hoyer |
4734ec |
+ inst_rules_wildcard 51-zfcp-*.rules
|
|
Harald Hoyer |
4734ec |
+ fi
|
|
Harald Hoyer |
4734ec |
+}
|
|
Harald Hoyer |
4734ec |
diff --git a/modules.d/95zfcp_rules/parse-zfcp.sh b/modules.d/95zfcp_rules/parse-zfcp.sh
|
|
Harald Hoyer |
4734ec |
new file mode 100755
|
|
Harald Hoyer |
4734ec |
index 0000000..24dbdd3
|
|
Harald Hoyer |
4734ec |
--- /dev/null
|
|
Harald Hoyer |
4734ec |
+++ b/modules.d/95zfcp_rules/parse-zfcp.sh
|
|
Harald Hoyer |
4734ec |
@@ -0,0 +1,65 @@
|
|
Harald Hoyer |
4734ec |
+#!/bin/sh
|
|
Harald Hoyer |
4734ec |
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
Harald Hoyer |
4734ec |
+# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
Harald Hoyer |
4734ec |
+
|
|
Harald Hoyer |
4734ec |
+create_udev_rule() {
|
|
Harald Hoyer |
4734ec |
+ local ccw=$1
|
|
Harald Hoyer |
4734ec |
+ local wwpn=$2
|
|
Harald Hoyer |
4734ec |
+ local lun=$3
|
|
Harald Hoyer |
4734ec |
+ local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
|
|
Harald Hoyer |
4734ec |
+
|
|
Harald Hoyer |
4734ec |
+ local _cu_type _dev_type
|
|
Harald Hoyer |
4734ec |
+ local _rule=/etc/udev/rules.d/51-zfcp-${ccw}.rules
|
|
Harald Hoyer |
4734ec |
+
|
|
Harald Hoyer |
4734ec |
+ if [ -e /sys/bus/ccw/devices/${ccw} ] ; then
|
|
Harald Hoyer |
4734ec |
+ read _cu_type < /sys/bus/ccw/devices/${ccw}/cutype
|
|
Harald Hoyer |
4734ec |
+ read _dev_type < /sys/bus/ccw/devices/${ccw}/devtype
|
|
Harald Hoyer |
4734ec |
+ fi
|
|
Harald Hoyer |
4734ec |
+ if [ "$_cu_type" != "1731/03" ] ; then
|
|
Harald Hoyer |
4734ec |
+ return 0;
|
|
Harald Hoyer |
4734ec |
+ fi
|
|
Harald Hoyer |
4734ec |
+ if [ "$_dev_type" != "1732/03" ] && [ "$_dev_type" != "1732/04" ] ; then
|
|
Harald Hoyer |
4734ec |
+ return 0;
|
|
Harald Hoyer |
4734ec |
+ fi
|
|
Harald Hoyer |
4734ec |
+
|
|
Harald Hoyer |
4734ec |
+ [ -e ${_rule} ] && return 0
|
|
Harald Hoyer |
4734ec |
+
|
|
Harald Hoyer |
4734ec |
+ if [ ! -f "$_rule" ] ; then
|
|
Harald Hoyer |
4734ec |
+ cat > $_rule <
|
|
Harald Hoyer |
4734ec |
+ACTION=="add", SUBSYSTEM=="ccw", KERNEL=="$ccw", IMPORT{program}="collect $ccw %k ${ccw} zfcp"
|
|
Harald Hoyer |
4734ec |
+ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="zfcp", IMPORT{program}="collect $ccw %k ${ccw} zfcp"
|
|
Harald Hoyer |
4734ec |
+ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
|
|
Harald Hoyer |
4734ec |
+EOF
|
|
Harald Hoyer |
4734ec |
+ fi
|
|
Harald Hoyer |
4734ec |
+ m=$(sed -n "/.*${wwpn}.*${lun}.*/p" $_rule)
|
|
Harald Hoyer |
4734ec |
+ if [ -z "$m" ] ; then
|
|
Harald Hoyer |
4734ec |
+ cat >> $_rule <
|
|
Harald Hoyer |
4734ec |
+ACTION=="add", KERNEL=="rport-*", ATTR{port_name}=="$wwpn", SUBSYSTEMS=="ccw", KERNELS=="$ccw", ATTR{[ccw/$ccw]$wwpn/unit_add}="$lun"
|
|
Harald Hoyer |
4734ec |
+EOF
|
|
Harald Hoyer |
4734ec |
+ fi
|
|
Harald Hoyer |
4734ec |
+}
|
|
Harald Hoyer |
4734ec |
+
|
|
Harald Hoyer |
4734ec |
+for zfcp_arg in $(getargs rd.zfcp); do
|
|
Harald Hoyer |
4734ec |
+ (
|
|
Harald Hoyer |
4734ec |
+ IFS=","
|
|
Harald Hoyer |
4734ec |
+ set $zfcp_arg
|
|
Harald Hoyer |
4734ec |
+ create_udev_rule $1 $2 $3
|
|
Harald Hoyer |
4734ec |
+ )
|
|
Harald Hoyer |
4734ec |
+done
|
|
Harald Hoyer |
4734ec |
+
|
|
Harald Hoyer |
4734ec |
+for zfcp_arg in $(getargs root=) $(getargs resume=); do
|
|
Harald Hoyer |
4734ec |
+ (
|
|
Harald Hoyer |
4734ec |
+ case $zfcp_arg in
|
|
Harald Hoyer |
4734ec |
+ /dev/disk/by-path/ccw-*)
|
|
Harald Hoyer |
4734ec |
+ ccw_arg=${zfcp_arg##*/}
|
|
Harald Hoyer |
4734ec |
+ break;
|
|
Harald Hoyer |
4734ec |
+ esac
|
|
Harald Hoyer |
4734ec |
+ if [ -n "$ccw_arg" ] ; then
|
|
Harald Hoyer |
4734ec |
+ IFS="-"
|
|
Harald Hoyer |
4734ec |
+ set -- $ccw_arg
|
|
Harald Hoyer |
4734ec |
+ wwpn=${4%:*}
|
|
Harald Hoyer |
4734ec |
+ lun=${4#*:}
|
|
Harald Hoyer |
4734ec |
+ create_udev_rule $2 $wwpn $lun
|
|
Harald Hoyer |
4734ec |
+ fi
|
|
Harald Hoyer |
4734ec |
+ )
|
|
Harald Hoyer |
4734ec |
+done
|