Blob Blame History Raw
From af97814e42c3942005f7201f9afdeee363111796 Mon Sep 17 00:00:00 2001
From: Lukas Nykryn <lnykryn@redhat.com>
Date: Thu, 26 Jul 2018 14:43:37 +0200
Subject: [PATCH] Revert "add 90multipath-hostonly module"

This reverts commit 6ef3173e86c2be99b504f7c7a789dea5c0072f64.

Cherry-picked from: 35e86ac117acbfd699f371f163cdda9db0ebc047
Resolves: #1599592
---
 .../90multipath-hostonly/module-setup.sh      | 53 -------------------
 modules.d/90multipath/module-setup.sh         | 26 +++++++++
 2 files changed, 26 insertions(+), 53 deletions(-)
 delete mode 100755 modules.d/90multipath-hostonly/module-setup.sh

diff --git a/modules.d/90multipath-hostonly/module-setup.sh b/modules.d/90multipath-hostonly/module-setup.sh
deleted file mode 100755
index 88839033..00000000
--- a/modules.d/90multipath-hostonly/module-setup.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-
-# called by dracut
-check() {
-    return 255
-}
-
-# called by dracut
-depends() {
-    echo multipath
-    return 0
-}
-
-# called by dracut
-install() {
-    local _f _allow
-
-    is_mpath() {
-        local _dev=$1
-        [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
-        [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
-        return 1
-    }
-
-    majmin_to_mpath_dev() {
-        local _dev
-        for i in /dev/mapper/*; do
-            [[ $i == /dev/mapper/control ]] && continue
-            _dev=$(get_maj_min $i)
-            if [ "$_dev" = "$1" ]; then
-                echo $i
-                return
-            fi
-        done
-    }
-
-    add_hostonly_mpath_conf() {
-        is_mpath $1 && {
-            local _dev
-
-            _dev=$(majmin_to_mpath_dev $1)
-            [ -z "$_dev" ] && return
-            strstr "$_allow" "$_dev" && return
-            _allow="$_allow --allow $_dev"
-        }
-    }
-
-    [[ $hostonly ]] && {
-        for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
-        [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
-    }
-}
-
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index 232ddcd8..a9238884 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -9,6 +9,17 @@ is_mpath() {
     return 1
 }
 
+majmin_to_mpath_dev() {
+    local _dev
+    for i in /dev/mapper/*; do
+        [[ $i == /dev/mapper/control ]] && continue
+        _dev=$(get_maj_min $i)
+        if [ "$_dev" = "$1" ]; then
+            echo $i
+            return
+        fi
+    done
+}
 
 check() {
     local _rootdev
@@ -70,6 +81,16 @@ installkernel() {
 
 install() {
     local _f _allow
+    add_hostonly_mpath_conf() {
+        is_mpath $1 && {
+            local _dev
+
+            _dev=$(majmin_to_mpath_dev $1)
+            [ -z "$_dev" ] && return
+            strstr "$_allow" "$_dev" && return
+            _allow="$_allow --allow $_dev"
+        }
+    }
 
     inst_multiple -o  \
         dmsetup \
@@ -84,6 +105,11 @@ install() {
         /etc/multipath.conf \
         /etc/multipath/*
 
+    [[ $hostonly ]] && [[ $hostonly_mode = "strict" ]] && {
+        for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
+        [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
+    }
+
     inst $(command -v partx) /sbin/partx
 
     inst_libdir_file "libmultipath*" "multipath/*"