public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/s390utils] f44: dasd: migrate to consolidated persistent device config with zdev (#1937046,#1937048)
@ 2026-08-05  9:17 Steffen Maier
  0 siblings, 0 replies; only message in thread
From: Steffen Maier @ 2026-08-05  9:17 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/s390utils
            Branch : f44
            Commit : 1151e06f2172682492d1e65cf4b8f96c2e35e020
            Author : Steffen Maier <maier@linux.ibm.com>
            Date   : 2026-05-26T12:57:33+02:00
            Stats  : +51/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/s390utils/c/1151e06f2172682492d1e65cf4b8f96c2e35e020?branch=f44

            Log:
            dasd: migrate to consolidated persistent device config with zdev (#1937046,#1937048)

Implements the dasd part of referenced bugs.

The new script dasdconfmigrate.sh needs to be called at an appropriate time
during distribution upgrade. If /etc/dasd.conf exists, automatically
migrate /etc/dasd.conf to zdev persistent config and move the old dasd.conf
to a backup file. To prevent overwriting potentially existing backups of
the old persistent configuration, simply use a timestamp so we don't
overwrite old migration backups.

Nothing should ever add device bus-IDs to the dasd option for the dasd
kernel module ("dasd.dasd=..." on the kernel command line or corresponding
modprobe.d files with "options dasd dasd=..."). The dasd module option is
supposed to be only used for global settings. Individual DASD devices
should only be configured by means of chzdev.

The only exception is to enable DASDs at boot time for a non-hostonly
initrd such as when booting a distro installer.

Signed-off-by: Steffen Maier <maier@linux.ibm.com>

---
diff --git a/dasdconfmigrate.sh b/dasdconfmigrate.sh
new file mode 100644
index 0000000..30f4d0d
--- /dev/null
+++ b/dasdconfmigrate.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# SPDX-License-Identifier: MIT
+# Copyright IBM Corp. 2023
+
+# This is just a wrapper to migrate old /etc/dasd.conf to the new
+# consolidated persistent configuration of s390 devices with chzdev.
+
+CONFIG=/etc/dasd.conf
+PATH=/sbin:/bin
+export PATH
+
+DATE=$(date --iso-8601=seconds)
+PREFIX="${CONFIG}.${DATE}.migrated-to-chzdev"
+
+if [ -f "$CONFIG" ]; then
+    # show migration output to users and log it into file
+    exec > >(tee "${PREFIX}.log") 2>&1
+    sed 'y/ABCDEF/abcdef/' < $CONFIG | while read -r line; do
+        case $line in
+            \#*) ;;
+            *)
+                [ -z "$line" ] && continue
+		# shellcheck disable=SC2086
+                set -- $line
+
+		chzdev --enable --active --persistent dasd "$@" --yes --no-root-update --force --no-settle
+		case $? in
+		    0)
+			# If device exists and could be actively enabled,
+			# chzdev could infer the actual dasd device type; done.
+			continue
+			;;
+		esac
+		# Configure persistently only to allow migration of
+		# configuration for devices that currently do not exist.
+		# Chzdev cannot infer the actual dasd device type for an
+		# absent device. Therefore, create duplicate configurations
+		# for both dasd-eckd and dasd-fba, so either one of them
+		# can enable such device when it appears.
+		chzdev --enable --persistent dasd-eckd "$@" --yes --no-root-update --force --no-settle
+		chzdev --enable --persistent dasd-fba "$@" --yes --no-root-update --force --no-settle
+                ;;
+        esac
+    done
+    mv "$CONFIG" "$CONFIG"."$DATE".migrated-to-chzdev
+    echo "dasdconfmigrate.sh: Information: Your persistent dasd device configuration file $CONFIG 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"
+fi

diff --git a/s390utils.spec b/s390utils.spec
index 25d8e3e..87e7e3a 100644
--- a/s390utils.spec
+++ b/s390utils.spec
@@ -65,6 +65,7 @@ Source23:       20-zipl-kernel.install
 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
 
 
 %if %{with signzipl}
@@ -215,6 +216,7 @@ mkdir -p %{buildroot}{/boot,%{_udevrulesdir},%{_sysconfdir}/{profile.d,sysconfig
 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 %{SOURCE13} %{buildroot}%{_sbindir}
 install -p -m 755 %{SOURCE21} %{buildroot}%{_sbindir}
 install -p -m 644 %{SOURCE7} %{buildroot}%{_udevrulesdir}/56-zfcp.rules
@@ -405,6 +407,7 @@ This package provides minimal set of tools needed to system to boot.
 %ghost %config(noreplace) %{_sysconfdir}/zfcp.conf
 %{_sbindir}/dasdconf.sh
 %{_sbindir}/normalize_dasd_arg
+%{_sbindir}/dasdconfmigrate.sh
 %{_sbindir}/zfcpconf.sh
 %{_sbindir}/zfcpconfmigrate.sh
 %{_sbindir}/device_cio_free

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-05  9:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-05  9:17 [rpms/s390utils] f44: dasd: migrate to consolidated persistent device config with zdev (#1937046,#1937048) Steffen Maier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox