public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Steffen Maier <maier@linux.ibm.com>
To: git-commits@fedoraproject.org
Subject: [rpms/s390utils] f44: znet: migrate to consolidated persistent device config with zdev (#1937046,#1937048)
Date: Wed, 05 Aug 2026 09:17:01 GMT [thread overview]
Message-ID: <178592142102.1.8812257157106923967.rpms-s390utils-8c9b660dca0f@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/s390utils
Branch : f44
Commit : 8c9b660dca0f70f15320fc924e0b46e03a793d78
Author : Steffen Maier <maier@linux.ibm.com>
Date : 2026-05-26T12:57:44+02:00
Stats : +106/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/s390utils/c/8c9b660dca0f70f15320fc924e0b46e03a793d78?branch=f44
Log:
znet: migrate to consolidated persistent device config with zdev (#1937046,#1937048)
Implements the s390 channel-attached network device, and thus the last,
part of referenced bugs.
In contrast to ccw_init, which only seems to configure LAYER2 mode, the new
migration script migrates all s390 options from nmconnections and so all
options will be effective after migration.
The new script znetconfmigrate.sh needs to be called at an appropriate time
during distribution upgrade. For any ifcfg or NetworkManager
configurations, it automatically migrates the s390-specific part to zdev
persistent config, exports a backup file of the old configuration, and
removes the s390-specific part from the old configuration.
To prevent overwriting potentially existing backups of the old persistent
configuration, simply use a timestamp so we don't overwrite old migration
backups.
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
---
diff --git a/s390utils.spec b/s390utils.spec
index 87e7e3a..deb4878 100644
--- a/s390utils.spec
+++ b/s390utils.spec
@@ -66,6 +66,7 @@ Source24: 52-zipl-rescue.install
Source25: 91-zipl.install
Source26: https://fedorapeople.org/cgit/sharkcz/public_git/utils.git/tree/zfcpconfmigrate.sh
Source27: https://fedorapeople.org/cgit/sharkcz/public_git/utils.git/tree/dasdconfmigrate.sh
+Source28: https://fedorapeople.org/cgit/sharkcz/public_git/utils.git/tree/znetconfmigrate.sh
%if %{with signzipl}
@@ -217,6 +218,7 @@ install -p -m 644 zipl/boot/tape0.bin %{buildroot}/boot/tape0
install -p -m 755 %{SOURCE5} %{buildroot}%{_sbindir}
install -p -m 755 %{SOURCE26} %{buildroot}%{_sbindir}
install -p -m 755 %{SOURCE27} %{buildroot}%{_sbindir}
+install -p -m 755 %{SOURCE28} %{buildroot}%{_sbindir}
install -p -m 755 %{SOURCE13} %{buildroot}%{_sbindir}
install -p -m 755 %{SOURCE21} %{buildroot}%{_sbindir}
install -p -m 644 %{SOURCE7} %{buildroot}%{_udevrulesdir}/56-zfcp.rules
@@ -410,6 +412,7 @@ This package provides minimal set of tools needed to system to boot.
%{_sbindir}/dasdconfmigrate.sh
%{_sbindir}/zfcpconf.sh
%{_sbindir}/zfcpconfmigrate.sh
+%{_sbindir}/znetconfmigrate.sh
%{_sbindir}/device_cio_free
%{_sbindir}/dasd_cio_free
%{_sbindir}/zfcp_cio_free
diff --git a/znetconfmigrate.sh b/znetconfmigrate.sh
new file mode 100644
index 0000000..07a916a
--- /dev/null
+++ b/znetconfmigrate.sh
@@ -0,0 +1,103 @@
+#! /bin/bash
+
+# SPDX-License-Identifier: MIT
+# Largely based on the old ccw_init script.
+
+# This is just a wrapper to migrate old s390 channel-attached network
+# device config to the new consolidated persistent configuration with
+# chzdev.
+
+DATE=$(date --iso-8601=seconds)
+
+# borrowed from network-scrips, initscripts along with the get_config_by_subchannel
+[ -z "$__sed_discard_ignored_files" ] && __sed_discard_ignored_files='/\(~\|\.bak\|\.old\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
+
+get_configs ()
+{
+ LANG=C grep -E -i -l \
+ "^[[:space:]]*SUBCHANNELS=['\"]?([0-9]\.[0-9]\.[a-f0-9]+)(,[0-9]\.[0-9]\.[a-f0-9]+){1,2}['\"]?([[:space:]]+#|[[:space:]]*$)" \
+ /etc/sysconfig/network-scripts/ifcfg-* \
+ | LC_ALL=C sed -e "$__sed_discard_ignored_files"
+}
+
+get_configs_nm ()
+{
+ LANG=C grep -E -i -l \
+ "^s390-subchannels=([0-9]\.[0-9]\.[a-f0-9]+;){2,3}$" \
+ /etc/NetworkManager/system-connections/*.nmconnection \
+ | LC_ALL=C sed -e "$__sed_discard_ignored_files"
+}
+
+migrate ()
+{
+# translate variables from the interface config files to OPTIONS
+if [ -n "$PORTNAME" ]; then
+ if [ "$NETTYPE" = "lcs" ]; then
+ OPTIONS="$OPTIONS portno=$PORTNAME"
+ else
+ OPTIONS="$OPTIONS portname=$PORTNAME"
+ fi
+fi
+if [ "$NETTYPE" = "ctc" -a -n "$CTCPROT" ]; then
+ OPTIONS="$OPTIONS protocol=$CTCPROT"
+fi
+
+# SUBCHANNELS is only set on mainframe ccwgroup devices
+[ -z "$SUBCHANNELS" -o -z "$NETTYPE" ] && return
+
+SUBCHANNELS=$(echo "$SUBCHANNELS" | tr ',' ':')
+
+# shellcheck disable=SC2086
+chzdev --enable --persistent "$NETTYPE" "$SUBCHANNELS" $OPTIONS --yes --no-root-update --force --no-settle
+
+# Leave all s390-specifics in original $CONFIG_FILE because NetworkManager
+# does something with NETTYPE, PORTNAME, CTCPROT, OPTIONS.
+# Definitively Leave SUBCHANNELS as it might serve as interface identifier key,
+# which is not HWADDR.
+
+echo "znetconfmigrate.sh: Information: Your low-level persistent s390 network device configuration $CONFIG_FILE was migrated to the new consolidated mechanism. From now on, please use lszdev and chzdev from s390utils instead. To finally complete the migration, please run: kdumpctl rebuild; systemctl restart kdump; dracut -f; zipl"
+
+# re-initialize global variables before next possible iteration loop
+NETTYPE=""
+SUBCHANNELS=""
+OPTIONS=""
+PORTNAME=""
+CTCPROT=""
+}
+
+NOLOCALE="yes"
+
+CONFIG_FILES=$(get_configs)
+if [ -n "$CONFIG_FILES" ]; then
+ for CONFIG_FILE in $CONFIG_FILES; do
+ PREFIX="znet.${CONFIG_FILE##*/}.${DATE}.migrated-to-chzdev"
+ # show migration output to users and log it into file
+ exec > >(tee "$PREFIX.log") 2>&1
+ . "$CONFIG_FILE"
+ migrate
+ done
+else
+ CONFIG_FILES=$(get_configs_nm)
+ for CONFIG_FILE in $CONFIG_FILES; do
+ PREFIX="znet.${CONFIG_FILE##*/}.${DATE}.migrated-to-chzdev"
+ # show migration output to users and log it into file
+ exec > >(tee "$PREFIX.log") 2>&1
+ NETTYPE=$(sed -nr "/^\[ethernet\]/ { :l /^s390-nettype[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" "$CONFIG_FILE")
+ SUBCHANNELS=$(sed -nr "/^\[ethernet\]/ { :l /^s390-subchannels[ ]*=/ { s/.*=[ ]*//; p; q;}; n; b l;}" "$CONFIG_FILE" | sed -e "s/;/,/g" -e "s/,$//")
+ OPTIONS=$(sed -nr "
+/^\[ethernet-s390-options\]/ {
+ n # skip matched line with beginning of section
+ :l # set label
+ /^[^#].*=.*/ { # match non-comment key value line
+ p # print
+ }
+ /^[ ]*\[/ { # match beginning of next section
+ q # quit
+ }
+ n # next
+ b l # branch to label
+}
+" "$CONFIG_FILE")
+ migrate
+ done
+fi
reply other threads:[~2026-08-05 9:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178592142102.1.8812257157106923967.rpms-s390utils-8c9b660dca0f@fedoraproject.org \
--to=maier@linux.ibm.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox