Blame SOURCES/0550-Revert-add-90multipath-hostonly-module.patch

0903d0
From af97814e42c3942005f7201f9afdeee363111796 Mon Sep 17 00:00:00 2001
0903d0
From: Lukas Nykryn <lnykryn@redhat.com>
0903d0
Date: Thu, 26 Jul 2018 14:43:37 +0200
0903d0
Subject: [PATCH] Revert "add 90multipath-hostonly module"
0903d0
0903d0
This reverts commit 6ef3173e86c2be99b504f7c7a789dea5c0072f64.
0903d0
0903d0
Cherry-picked from: 35e86ac117acbfd699f371f163cdda9db0ebc047
0903d0
Resolves: #1599592
0903d0
---
0903d0
 modules.d/90multipath-hostonly/module-setup.sh | 53 --------------------------
0903d0
 modules.d/90multipath/module-setup.sh          | 26 +++++++++++++
0903d0
 2 files changed, 26 insertions(+), 53 deletions(-)
0903d0
 delete mode 100755 modules.d/90multipath-hostonly/module-setup.sh
0903d0
0903d0
diff --git a/modules.d/90multipath-hostonly/module-setup.sh b/modules.d/90multipath-hostonly/module-setup.sh
0903d0
deleted file mode 100755
0903d0
index 88839033..00000000
0903d0
--- a/modules.d/90multipath-hostonly/module-setup.sh
0903d0
+++ /dev/null
0903d0
@@ -1,53 +0,0 @@
0903d0
-#!/bin/bash
0903d0
-
0903d0
-# called by dracut
0903d0
-check() {
0903d0
-    return 255
0903d0
-}
0903d0
-
0903d0
-# called by dracut
0903d0
-depends() {
0903d0
-    echo multipath
0903d0
-    return 0
0903d0
-}
0903d0
-
0903d0
-# called by dracut
0903d0
-install() {
0903d0
-    local _f _allow
0903d0
-
0903d0
-    is_mpath() {
0903d0
-        local _dev=$1
0903d0
-        [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
0903d0
-        [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0
0903d0
-        return 1
0903d0
-    }
0903d0
-
0903d0
-    majmin_to_mpath_dev() {
0903d0
-        local _dev
0903d0
-        for i in /dev/mapper/*; do
0903d0
-            [[ $i == /dev/mapper/control ]] && continue
0903d0
-            _dev=$(get_maj_min $i)
0903d0
-            if [ "$_dev" = "$1" ]; then
0903d0
-                echo $i
0903d0
-                return
0903d0
-            fi
0903d0
-        done
0903d0
-    }
0903d0
-
0903d0
-    add_hostonly_mpath_conf() {
0903d0
-        is_mpath $1 && {
0903d0
-            local _dev
0903d0
-
0903d0
-            _dev=$(majmin_to_mpath_dev $1)
0903d0
-            [ -z "$_dev" ] && return
0903d0
-            strstr "$_allow" "$_dev" && return
0903d0
-            _allow="$_allow --allow $_dev"
0903d0
-        }
0903d0
-    }
0903d0
-
0903d0
-    [[ $hostonly ]] && {
0903d0
-        for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
0903d0
-        [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
0903d0
-    }
0903d0
-}
0903d0
-
0903d0
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
0903d0
index 232ddcd8..a9238884 100755
0903d0
--- a/modules.d/90multipath/module-setup.sh
0903d0
+++ b/modules.d/90multipath/module-setup.sh
0903d0
@@ -9,6 +9,17 @@ is_mpath() {
0903d0
     return 1
0903d0
 }
0903d0
 
0903d0
+majmin_to_mpath_dev() {
0903d0
+    local _dev
0903d0
+    for i in /dev/mapper/*; do
0903d0
+        [[ $i == /dev/mapper/control ]] && continue
0903d0
+        _dev=$(get_maj_min $i)
0903d0
+        if [ "$_dev" = "$1" ]; then
0903d0
+            echo $i
0903d0
+            return
0903d0
+        fi
0903d0
+    done
0903d0
+}
0903d0
 
0903d0
 check() {
0903d0
     local _rootdev
0903d0
@@ -70,6 +81,16 @@ installkernel() {
0903d0
 
0903d0
 install() {
0903d0
     local _f _allow
0903d0
+    add_hostonly_mpath_conf() {
0903d0
+        is_mpath $1 && {
0903d0
+            local _dev
0903d0
+
0903d0
+            _dev=$(majmin_to_mpath_dev $1)
0903d0
+            [ -z "$_dev" ] && return
0903d0
+            strstr "$_allow" "$_dev" && return
0903d0
+            _allow="$_allow --allow $_dev"
0903d0
+        }
0903d0
+    }
0903d0
 
0903d0
     inst_multiple -o  \
0903d0
         dmsetup \
0903d0
@@ -84,6 +105,11 @@ install() {
0903d0
         /etc/multipath.conf \
0903d0
         /etc/multipath/*
0903d0
 
0903d0
+    [[ $hostonly ]] && [[ $hostonly_mode = "strict" ]] && {
0903d0
+        for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
0903d0
+        [ -n "$_allow" ] && mpathconf $_allow --outfile ${initdir}/etc/multipath.conf
0903d0
+    }
0903d0
+
0903d0
     inst $(command -v partx) /sbin/partx
0903d0
 
0903d0
     inst_libdir_file "libmultipath*" "multipath/*"