Harald Hoyer a4fab5
From: Peter Jones <pjones@redhat.com>
Harald Hoyer a4fab5
Subject: [PATCH] Add a check file for multipath.
Harald Hoyer a4fab5
Date: 	Fri, 22 Jan 2010 10:56:40 -0500
Harald Hoyer a4fab5

Harald Hoyer a4fab5
If multipath isn't installed, don't use it.  If we're in hostonly mode,
Harald Hoyer a4fab5
only install the multipath module if it's used for / .  Otherwise, if
Harald Hoyer a4fab5
the user was dumb enough to install it, they get it during bootup.
Harald Hoyer a4fab5
---
Harald Hoyer a4fab5
 modules.d/90multipath/check |   27 +++++++++++++++++++++++++++
Harald Hoyer a4fab5
 1 files changed, 27 insertions(+), 0 deletions(-)
Harald Hoyer a4fab5
 create mode 100755 modules.d/90multipath/check
Harald Hoyer a4fab5

Harald Hoyer a4fab5
diff --git a/modules.d/90multipath/check b/modules.d/90multipath/check
Harald Hoyer a4fab5
new file mode 100755
Harald Hoyer a4fab5
index 0000000..d0cad4c
Harald Hoyer a4fab5
--- /dev/null
Harald Hoyer a4fab5
+++ b/modules.d/90multipath/check
Harald Hoyer a4fab5
@@ -0,0 +1,27 @@
Harald Hoyer a4fab5
+#!/bin/bash
Harald Hoyer a4fab5
+
Harald Hoyer a4fab5
+# if there's no multipath binary, no go.
Harald Hoyer a4fab5
+which multipath >/dev/null 2>&1 || exit 1
Harald Hoyer a4fab5
+
Harald Hoyer a4fab5
+[[ $1 = -d ]] && exit 0
Harald Hoyer a4fab5
+
Harald Hoyer a4fab5
+. $dracutfunctions
Harald Hoyer a4fab5
+[[ $debug ]] && set -x
Harald Hoyer a4fab5
+
Harald Hoyer a4fab5
+is_mpath() {
Harald Hoyer a4fab5
+    [ -e /sys/dev/block/$1/dm/uuid ] || return 1
Harald Hoyer a4fab5
+    [[ $(cat /sys/dev/block/$1/dm/uuid) =~ ^mpath- ]] && return 0
Harald Hoyer a4fab5
+    return 1
Harald Hoyer a4fab5
+}
Harald Hoyer a4fab5
+
Harald Hoyer a4fab5
+# If we're in hostonly mode, do mpath if we appear to be using it for /
Harald Hoyer a4fab5
+if [[ $1 = -h ]]; then
Harald Hoyer a4fab5
+    rootdev=$(find_root_block_device)
Harald Hoyer a4fab5
+    if [[ $rootdev ]]; then
Harald Hoyer a4fab5
+        check_block_and_slaves is_mpath "$rootdev" && exit 0
Harald Hoyer a4fab5
+    fi
Harald Hoyer a4fab5
+    exit 1
Harald Hoyer a4fab5
+fi
Harald Hoyer a4fab5
+
Harald Hoyer a4fab5
+# the user installed it, they get it...
Harald Hoyer a4fab5
+exit 0
Harald Hoyer a4fab5
-- 
Harald Hoyer a4fab5
1.6.5.2
Harald Hoyer a4fab5