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

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