Blob Blame History Raw
From 3a9b9a5cf507a868f8b3ec33cf686b3a552286c2 Mon Sep 17 00:00:00 2001
From: Steffen Maier <maier@linux.ibm.com>
Date: Sat, 28 Jan 2023 01:58:29 +0100
Subject: [PATCH 04/23] refactor(cms): use consolidated zfcp config with zdev
 from s390-tools

This is just internal to initrd, so we can already migrate the code to
consolidated zfcp device configuration with zdev
https://github.com/ibm-s390-linux/s390-tools/tree/master/zdev/.
The code change is transparent to users after dracut switch root.

The generated persistent config of chzdev are pure udev rules so it has no
dependency on other dracut modules such as zdev, or zfcp.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
 modules.d/80cms/cmssetup.sh     | 21 ++++++++++++++++-----
 modules.d/80cms/module-setup.sh |  2 +-
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/modules.d/80cms/cmssetup.sh b/modules.d/80cms/cmssetup.sh
index 23e81ca9..da42ec0f 100755
--- a/modules.d/80cms/cmssetup.sh
+++ b/modules.d/80cms/cmssetup.sh
@@ -117,7 +117,6 @@ processcmsfile() {
         dasd_cio_free
     fi
 
-    unset _do_zfcp
     for i in ${!FCP_*}; do
         echo "${!i}" | while read -r port rest || [ -n "$port" ]; do
             case $port in
@@ -130,12 +129,24 @@ processcmsfile() {
                     port="0.0.$port"
                     ;;
             esac
-            echo "$port" "$rest" >> /etc/zfcp.conf
+            # shellcheck disable=SC2086
+            set -- $rest
+            SAVED_IFS="$IFS"
+            IFS=":"
+            # Intentionally do not dynamically activate now, but only generate udev
+            # rules, which activate the device later during udev coldplug.
+            if [[ -z $rest ]]; then
+                chzdev --enable --persistent \
+                    --no-settle --yes --quiet --no-root-update --force \
+                    zfcp-host "$port" 2>&1 | vinfo
+            else
+                chzdev --enable --persistent \
+                    --no-settle --yes --quiet --no-root-update --force \
+                    zfcp-lun "$port:$*" 2>&1 | vinfo
+            fi
+            IFS="$SAVED_IFS"
         done
-        _do_zfcp=1
     done
-    [[ $_do_zfcp ]] && zfcp_cio_free
-    unset _do_zfcp
 }
 
 [[ $CMSDASD ]] || CMSDASD=$(getarg "CMSDASD=")
diff --git a/modules.d/80cms/module-setup.sh b/modules.d/80cms/module-setup.sh
index 4872734b..0dd86b80 100755
--- a/modules.d/80cms/module-setup.sh
+++ b/modules.d/80cms/module-setup.sh
@@ -12,7 +12,7 @@ check() {
 depends() {
     arch=${DRACUT_ARCH:-$(uname -m)}
     [ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
-    echo znet zfcp dasd dasd_mod bash
+    echo znet dasd dasd_mod bash
     return 0
 }
 
-- 
2.42.0