dracut/0013-feat-znet-use-zdev-for-consolidated-device-configura.patch
Pavel Valena e4f609fba2 Update to dracut 101
From-source-git-commit: a24e1272faba2875f9b78fcf42109028af0869bc

 * switch to dracut-ng upstream fork

The original dracut repository is no longer maintained, new initiative was started:
https://github.com/dracut-ng/dracut-ng/

 * applied additional fixes

9df3cb58a19f38157a615c311356cfd6ae55d2d7 fix(rngd): install system service file
0b65ac224d831cc96da940cce510523c7276a5ec feat(hwdb): add hwdb module to install hwdb.bin on demand
10b86edba3ffe0ce13c5f43ff0193cdf04661358 fix(nvmf): move /etc/nvme/host{nqn,id} requirement to hostonly
bad2bc80cdcfac8915374497cc47ce9d5670d015 fix(systemd): explicitly install some libs that will not be statically included
55a56c546bde71fb42c99aadd96e98fca2199823 fix(dracut): move hooks directory from /usr/lib to /var/lib
110fec3e41faf47277447f1c56635c5a876c1f96 feat(ifcfg): minimize s390-specific network configuration aspects
b6913f66b6c9e9ea81fd0832405c170876bc993a refactor(ifcfg): delete code duplication using iface_get_subchannels()
cbc5eece88b8f6d0e69fdfbb8f34eabb45425c86 fix(znet): append to udev rules so each rd.znet_ifname is effective
7ad6fef8fe110093939c422b5c3b381ebe47e4e9 feat(qeth_rules): remove qeth handling consolidated in 95znet
addb383b375fd0db07eacf8a9f5d9b4e23343855 docs(dracut.cmdline): generalize description of rd.znet
86b6e2979999cf5ecce8c76c6230d1f085b3a333 feat(znet): use zdev for consolidated device configuration
1ff6be8aef787513b8143df444a1dd2d696b0944 feat(dasd): minimize dasd handling consolidated in s390-tools
a82045ef34bc8c913502eba37b6b9c60709d6997 feat(dasd_mod): minimize dasd handling consolidated in s390-tools
7294e45b5204e47bb8ee2108e2c38c5843e64fac feat(dasd_rules): remove dasd handling consolidated in s390-tools
8d6098969aa9dc34edfd1bc96e6aa0384ae2fb99 feat(zfcp): minimize zfcp handling consolidated in s390-tools
71876ea8c73090741bdf26abb89c28fb260ed575 feat(zfcp_rules): remove zfcp handling consolidated in s390-tools
a2c1fc530d8bcbdeaf1806f4a22019052715fc98 refactor(cms): remove now unnecessary inclusion of full s390utils-base
cc14fe218861f2855ca88ad03220ecb78d4aa31a refactor(cms): use consolidated network config with zdev from s390-tools
74edb9758da26ef063e4686a595f1d34f07f86f7 refactor(cms): use consolidated dasd config with zdev from s390-tools
3a9b9a5cf507a868f8b3ec33cf686b3a552286c2 refactor(cms): use consolidated zfcp config with zdev from s390-tools
38412977daad049b12273966300d07211674834e refactor(cms): use zdev to simplify handling CMSDASD=... boot option

(Possibly also resolves other open issues.)

Resolves: RHEL-26887 RHEL-34954 RHEL-35521
2024-05-16 19:11:40 +02:00

150 lines
5.8 KiB
Diff

From 86b6e2979999cf5ecce8c76c6230d1f085b3a333 Mon Sep 17 00:00:00 2001
From: Steffen Maier <maier@linux.ibm.com>
Date: Tue, 25 Jul 2023 19:43:05 +0200
Subject: [PATCH 13/23] feat(znet): use zdev for consolidated device
configuration
Remove any distribution-specifics from s390 channel-attached network device
configuration.
Similar to 95qeth_rules, copy the existing persistent network configuration
into the initrd. This needs to go via chzdev import so chzdev updates (adds
to) the cio_ignore persistent config inside the initrd, because other
dracut modules such as zdev from s390-tools also import
persistent (non-network) config into initrd and the set union of devices
needs to end up in the cio_ignore persistent config inside the initrd.
Additional debugging output can be generated with e.g. dracut option
"--stdlog 5" (or short -L5). It shows the chzdev export result, the output
of chzdev imports, and an overview of the resulting persistent config
within the initrd. Typically combined with "--debug" to get a shell trace
from building an initrd (Note: --debug does not increase the log levels).
Note that nm-initrd-generator also parses rd.znet and rd.znet_ifname
to fill in s390 options of a NetworkManager connection definition.
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
modules.d/95znet/module-setup.sh | 37 +++++++++++++++++++++++--
modules.d/95znet/parse-ccw.sh | 47 ++++++++++++++++++++++++++++++--
2 files changed, 78 insertions(+), 6 deletions(-)
diff --git a/modules.d/95znet/module-setup.sh b/modules.d/95znet/module-setup.sh
index df37c660..95164bba 100755
--- a/modules.d/95znet/module-setup.sh
+++ b/modules.d/95znet/module-setup.sh
@@ -5,7 +5,7 @@ check() {
arch=${DRACUT_ARCH:-$(uname -m)}
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
- require_binaries znet_cio_free grep sed seq readlink || return 1
+ require_binaries grep sed seq readlink chzdev || return 1
return 0
}
@@ -24,6 +24,37 @@ installkernel() {
# called by dracut
install() {
inst_hook cmdline 30 "$moddir/parse-ccw.sh"
- inst_rules 81-ccw.rules
- inst_multiple znet_cio_free grep sed seq readlink /lib/udev/ccw_init
+ inst_multiple grep sed seq readlink chzdev
+ if [[ $hostonly ]]; then
+ local _tempfile
+ _tempfile=$(mktemp --tmpdir="${DRACUT_TMPDIR}" dracut-zdev.XXXXXX)
+ {
+ chzdev qeth --export - --configured --persistent --quiet --type
+ chzdev lcs --export - --configured --persistent --quiet --type
+ chzdev ctc --export - --configured --persistent --quiet --type
+ } 2> /dev/null > "$_tempfile"
+ ddebug < "$_tempfile"
+ chzdev --import "$_tempfile" --persistent --base "/etc=$initdir/etc" \
+ --yes --no-root-update --force 2>&1 | ddebug
+ lszdev --configured --persistent --info \
+ --base "/etc=$initdir/etc" 2>&1 | ddebug
+ rm -f "$_tempfile"
+ # these are purely generated udev rules so we have to glob expand
+ # within $initdir and strip the $initdir prefix for mark_hostonly
+ local -a _array
+ # shellcheck disable=SC2155
+ local _nullglob=$(shopt -p nullglob)
+ shopt -u nullglob
+ # shellcheck disable=SC2086
+ readarray -t _array < <(
+ ls -1 $initdir/etc/udev/rules.d/41-*.rules 2> /dev/null
+ )
+ [[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}"
+ # shellcheck disable=SC2086
+ readarray -t _array < <(
+ ls -1 $initdir/etc/modprobe.d/s390x-*.conf 2> /dev/null
+ )
+ [[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}"
+ $_nullglob
+ fi
}
diff --git a/modules.d/95znet/parse-ccw.sh b/modules.d/95znet/parse-ccw.sh
index d8953605..aacc988e 100755
--- a/modules.d/95znet/parse-ccw.sh
+++ b/modules.d/95znet/parse-ccw.sh
@@ -1,7 +1,50 @@
#!/bin/bash
+znet_base_args="--no-settle --yes --no-root-update --force"
+
+# at this point in time dracut's vinfo() only logs to journal which is hard for
+# s390 users to find and access on a line mode console such as 3215 mode
+# so use a vinfo alternative that still prints to the console via kmsg
+znet_vinfo() {
+ while read -r _znet_vinfo_line || [ -n "$_znet_vinfo_line" ]; do
+ # Prefix "<30>" represents facility LOG_DAEMON 3 and loglevel INFO 6:
+ # (facility << 3) | level.
+ echo "<30>dracut: $_znet_vinfo_line" > /dev/kmsg
+ done
+}
+
for ccw_arg in $(getargs rd.ccw -d 'rd_CCW=') $(getargs rd.znet -d 'rd_ZNET='); do
- echo "$ccw_arg" >> /etc/ccw.conf
+ (
+ SAVED_IFS="$IFS"
+ IFS=","
+ # shellcheck disable=SC2086
+ set -- $ccw_arg
+ IFS="$SAVED_IFS"
+ type="$1"
+ subchannel1="$2"
+ subchannel2="$3"
+ subchannel3="$4"
+ echo "rd.znet ${ccw_arg} :" | znet_vinfo
+ if [ "$#" -lt 3 ]; then
+ echo "rd.znet needs at least 3 list items: type,subchannel1,subchannel2" | znet_vinfo
+ fi
+ if [ "$1" = "qeth" ]; then
+ if [ "$#" -lt 4 ]; then
+ echo "rd.znet for type qeth needs at least 4 list items: qeth,subchannel1,subchannel2,subchannel3" | znet_vinfo
+ fi
+ subchannels="$subchannel1:$subchannel2:$subchannel3"
+ shift 4
+ # shellcheck disable=SC2086
+ chzdev --enable --persistent $znet_base_args \
+ "$type" "$subchannels" "$@" 2>&1 | znet_vinfo
+ else
+ subchannels="$subchannel1:$subchannel2"
+ shift 3
+ # shellcheck disable=SC2086
+ chzdev --enable --persistent $znet_base_args \
+ "$type" "$subchannels" "$@" 2>&1 | znet_vinfo
+ fi
+ )
done
for ifname in $(getargs rd.znet_ifname); do
@@ -21,5 +64,3 @@ for ifname in $(getargs rd.znet_ifname); do
} > /etc/udev/rules.d/81-ccw-ifname.rules
fi
done
-
-znet_cio_free
--
2.42.0