]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
multipath: add automatic configuration for multipath
authorBen Howard <ben.howard@redhat.com>
Fri, 3 Apr 2020 19:32:44 +0000 (13:32 -0600)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 3 Apr 2020 21:48:32 +0000 (23:48 +0200)
Add support for 'rd.multipath=default' for using the default
configuration on boot. The intended purpose for this is to help support
ostree-based image boots from multipathed devices (such as Fedora and
Red Hat CoreOS).

dracut.cmdline.7.asc
modules.d/90multipath/module-setup.sh
modules.d/90multipath/multipathd-configure.service [new file with mode: 0644]
modules.d/90multipath/multipathd.sh

index 646f1f03c7570c47bf566c348884a9e258caec06..63074353894e152814d82d538ef93f418db06fce 100644 (file)
@@ -431,6 +431,9 @@ MULTIPATH
 **rd.multipath=0**::
    disable multipath detection
 
+**rd.multipath=default**::
+   use default multipath settings
+
 FIPS
 ~~~~
 **rd.fips**::
index 48a9d09a40af5b8faaf6f78302815b51993ecf0d..2bb7444bb5ff0d0bb1f751a13de5c30331ccc209 100755 (executable)
@@ -83,11 +83,12 @@ install() {
         dmsetup \
         kpartx \
         mpath_wait \
+        mpathconf \
+        mpathpersist \
         multipath  \
         multipathd \
-        mpathpersist \
-        xdrgetuid \
         xdrgetprio \
+        xdrgetuid \
         /etc/xdrdevices.conf \
         /etc/multipath.conf \
         /etc/multipath/* \
@@ -109,7 +110,9 @@ install() {
     fi
 
     if dracut_module_included "systemd"; then
+        inst_simple "${moddir}/multipathd-configure.service" "${systemdsystemunitdir}/multipathd-configure.service"
         inst_simple "${moddir}/multipathd.service" "${systemdsystemunitdir}/multipathd.service"
+        systemctl -q --root "$initdir" enable multipathd-configure.service
         systemctl -q --root "$initdir" enable multipathd.service
     else
         inst_hook pre-trigger 02 "$moddir/multipathd.sh"
diff --git a/modules.d/90multipath/multipathd-configure.service b/modules.d/90multipath/multipathd-configure.service
new file mode 100644 (file)
index 0000000..de69061
--- /dev/null
@@ -0,0 +1,19 @@
+[Unit]
+Description=Device-Mapper Multipath Default Configuration
+Before=iscsi.service iscsid.service lvm2-activation-early.service
+Wants=systemd-udev-trigger.service systemd-udev-settle.service local-fs-pre.target
+After=systemd-udev-trigger.service systemd-udev-settle.service
+Before=local-fs-pre.target multipathd.service
+DefaultDependencies=no
+Conflicts=shutdown.target
+
+ConditionKernelCommandLine=rd.multipath=default
+ConditionPathExists=!/etc/multipath.conf
+
+[Service]
+Type=oneshot
+ExecStartPre=-/usr/bin/mkdir -p /etc/multipath/multipath.conf.d
+ExecStart=/usr/sbin/mpathconf --enable
+
+[Install]
+WantedBy=sysinit.target
index 2c2dcc85c2cd777dcd592dc58eb37e06bd174d95..936c5dc7321bb4d84a55df85b3874d61496cd0b2 100755 (executable)
@@ -1,5 +1,10 @@
 #!/bin/sh
 
+if [ "$(getarg rd.multipath)x" == "default" ] && [ ! -e /etc/multipath.conf ]; then
+    mkdir -p /etc/multipath/multipath.conf.d
+    mpathconf --enable
+fi
+
 if getargbool 1 rd.multipath -d -n rd_NO_MULTIPATH && [ -e /etc/multipath.conf ]; then
     modprobe dm-multipath
     multipathd -B || multipathd