|
|
|
From 3d1bd59eb09780fe156bb24fc6709ce844f68052 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Harald Hoyer <harald@redhat.com>
|
|
|
|
Date: Tue, 25 Aug 2015 13:49:10 +0200
|
|
|
|
Subject: [PATCH] multipath: add hostonly multipath.conf
|
|
|
|
|
|
|
|
Resolves: rhbz#994702
|
|
|
|
---
|
|
|
|
modules.d/90multipath/module-setup.sh | 43 ++++++++++++++++++++++-----
|
|
|
|
1 file changed, 35 insertions(+), 8 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
|
|
|
|
index acfc56f8..4971d18d 100755
|
|
|
|
--- a/modules.d/90multipath/module-setup.sh
|
|
|
|
+++ b/modules.d/90multipath/module-setup.sh
|
|
|
|
@@ -2,18 +2,29 @@
|
|
|
|
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
|
|
|
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
|
|
|
|
|
|
+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 `ls -1 /dev/mapper/mpath*`; do
|
|
|
|
+ dev=$(get_maj_min $i)
|
|
|
|
+ if [ "$dev" = "$1" ]; then
|
|
|
|
+ echo $i
|
|
|
|
+ return
|
|
|
|
+ fi
|
|
|
|
+ done
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
check() {
|
|
|
|
local _rootdev
|
|
|
|
# if there's no multipath binary, no go.
|
|
|
|
require_binaries multipath || return 1
|
|
|
|
|
|
|
|
- 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
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
|
|
for_each_host_dev_and_slaves is_mpath || return 255
|
|
|
|
}
|
|
|
|
@@ -68,7 +79,18 @@ installkernel() {
|
|
|
|
}
|
|
|
|
|
|
|
|
install() {
|
|
|
|
- local _f
|
|
|
|
+ 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 \
|
|
|
|
kpartx \
|
|
|
|
@@ -82,6 +104,11 @@ install() {
|
|
|
|
/etc/multipath.conf \
|
|
|
|
/etc/multipath/*
|
|
|
|
|
|
|
|
+ [[ $hostonly ]] && {
|
|
|
|
+ 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/*"
|