dracut/0009-Add-zfcp-scripts-for-SUSE.patch
Raymond Wooninck c0e1df1a13 Accepting request 208892 from home:hreinecke:branches:Base:System
- Update with patches from git repository:
   * kernel-modules: add ohci-pci to the list of forced module installs
   * Run 'xz' and 'lzma' with multiple threads
   * systemd: do not exit the initqueue, if systemd asks a password
   * iscsi,nbd: do not fail in hostonly mode
   * dracut-functions.sh: Avoid loading unnecessary 32-bit libraries
     for 64-bit initrds
   * fips: also install /etc/system-fips in the initramfs
   * dracut.modules.7.asc: removed empty section
   * dracut.sh: fixed PATH shortener
   * dracut.spec: move /sbin/dracut to /usr/sbin/dracut
   * iscsi/nbd: do not try to mount the whole disk, if root= is missing
   * fips: include crct10dif_generic
   * Handle crypto modules with and without modaliases
   * usrmount/module-setup.sh: fixed typo
   * lvm: always install thin utils for lvm
   * kernel-modules(ARM): add mmc_block usb_storage to static list of
     kernel mods
   * dracut-functions.sh:check_block_and_slaves*() skip LVM internal devs
   * mkdir basic dirs in /run
   * network/fcoe: only redirect output to loginit.pipe, if exists
   * dracut.sh: no need to make subdirs in run
   * dracut.sh: also mkdir /run/lock, which is copied to
   * lvm: fix thin recognition
   * Add lzo, lz4 compression and read INITRD_COMPRESS
   * remove resume-genrules.sh
   * resume: fix swap detection in hostonly
   * base/init.sh: also mkdir /run/lock
   * dmsquash-live: add /dev/mapper/live-base
   * Doc: cleanup, extend and split and reuse

OBS-URL: https://build.opensuse.org/request/show/208892
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=82
2013-11-29 12:27:47 +00:00

122 lines
3.4 KiB
Diff

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