Blame 0033-iscsi-module-setup.sh-fix-host-only-mount-checks.patch

Harald Hoyer 14f838
From cb08b0132f6e6631b04576959549c0a0d8218afd Mon Sep 17 00:00:00 2001
Harald Hoyer a633d0
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer a633d0
Date: Wed, 25 Apr 2012 11:23:10 +0200
Harald Hoyer a633d0
Subject: [PATCH] iscsi/module-setup.sh: fix host-only/mount checks
Harald Hoyer a633d0
Harald Hoyer a633d0
---
Harald Hoyer a633d0
 modules.d/95iscsi/module-setup.sh |   16 ++++++----------
Harald Hoyer a633d0
 1 file changed, 6 insertions(+), 10 deletions(-)
Harald Hoyer a633d0
Harald Hoyer a633d0
diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
Harald Hoyer 14f838
index 2f343ee..bfd9d73 100755
Harald Hoyer a633d0
--- a/modules.d/95iscsi/module-setup.sh
Harald Hoyer a633d0
+++ b/modules.d/95iscsi/module-setup.sh
Harald Hoyer a633d0
@@ -15,8 +15,11 @@ check() {
Harald Hoyer a633d0
     [[ $debug ]] && set -x
Harald Hoyer a633d0
 
Harald Hoyer a633d0
     is_iscsi() (
Harald Hoyer a633d0
-        [[ -L /sys/dev/block/$1 ]] || return
Harald Hoyer a633d0
-        cd "$(readlink -f /sys/dev/block/$1)"
Harald Hoyer a633d0
+        local _dev
Harald Hoyer 14f838
+        _dev=$(get_maj_min $1)
Harald Hoyer a633d0
+
Harald Hoyer a633d0
+        [[ -L /sys/dev/block/$_dev ]] || return
Harald Hoyer a633d0
+        cd "$(readlink -f /sys/dev/block/$_dev)"
Harald Hoyer a633d0
         until [[ -d sys || -d iscsi_session ]]; do
Harald Hoyer a633d0
             cd ..
Harald Hoyer a633d0
         done
Harald Hoyer a633d0
@@ -24,14 +27,7 @@ check() {
Harald Hoyer a633d0
     )
Harald Hoyer a633d0
 
Harald Hoyer a633d0
     [[ $hostonly ]] || [[ $mount_needs ]] && {
Harald Hoyer a633d0
-        _rootdev=$(find_root_block_device)
Harald Hoyer a633d0
-        if [[ $_rootdev ]]; then
Harald Hoyer a633d0
-            # root lives on a block device, so we can be more precise about
Harald Hoyer a633d0
-            # hostonly checking
Harald Hoyer a633d0
-            check_block_and_slaves is_iscsi "$_rootdev" || return 1
Harald Hoyer a633d0
-        else
Harald Hoyer a633d0
-            return 1
Harald Hoyer a633d0
-        fi
Harald Hoyer a633d0
+        for_each_host_dev_fs is_iscsi || return 1
Harald Hoyer a633d0
     }
Harald Hoyer a633d0
     return 0
Harald Hoyer a633d0
 }