Re: dracut does not mount iscsi targets specified using --mount option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 24.04.2012 23:02, schrieb Vivek Goyal:
> Following is a small patch  which seems to fix the issue of dumping to
> multipath device for me. Is it this simple. Harald?
> 
> 
> ---
>  lib/dracut/modules.d/90multipath/module-setup.sh |   13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> Index: /lib/dracut/modules.d/90multipath/module-setup.sh
> ===================================================================
> --- .orig/lib/dracut/modules.d/90multipath/module-setup.sh	2012-04-16 10:03:27.000000000 -0400
> +++ /lib/dracut/modules.d/90multipath/module-setup.sh	2012-04-24 16:59:53.831999986 -0400
> @@ -17,11 +17,14 @@ check() {
>      }
>  
>      if [[ $hostonly ]]; then
> -        _rootdev=$(find_root_block_device)
> -        if [[ $_rootdev ]]; then
> -            check_block_and_slaves is_mpath "$_rootdev" && return 0
> -        fi
> -        return 1
> +	local _found
> +	local _dev
> +	for fs in ${host_fs_types[@]}; do
> +		_dev=$(echo $fs | awk -F '|' '{print $1}')
> +		is_mpath $(get_maj_min $_dev) && _found="1"
> +	done
> +	[[ $_found ]] || return 1
> +	unset _found
>      fi
>  
>      return 0
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


it can be even simpler:

diff --git a/modules.d/90multipath/module-setup.sh
b/modules.d/90multipath/module-setup.sh
index 2bc1b41..ae9ec59 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -11,18 +11,16 @@ check() {
     [[ $debug ]] && set -x

     is_mpath() {
-        [ -e /sys/dev/block/$1/dm/uuid ] || return 1
-        [[ $(cat /sys/dev/block/$1/dm/uuid) =~ ^mpath- ]] && return 0
+        local _dev
+        _dev=${1##/dev/}
+        [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1
+        [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ ^mpath- ]] && return 0
         return 1
     }

-    if [[ $hostonly ]]; then
-        _rootdev=$(find_root_block_device)
-        if [[ $_rootdev ]]; then
-            check_block_and_slaves is_mpath "$_rootdev" && return 0
-        fi
-        return 1
-    fi
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
+        for_each_host_dev_fs is_mpath || return 1
+    }

     return 0
 }

diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 2f343ee..34e101c 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -15,8 +15,11 @@ check() {
     [[ $debug ]] && set -x

     is_iscsi() (
-        [[ -L /sys/dev/block/$1 ]] || return
-        cd "$(readlink -f /sys/dev/block/$1)"
+        local _dev
+        _dev=${1##/dev/}
+
+        [[ -L /sys/dev/block/$_dev ]] || return
+        cd "$(readlink -f /sys/dev/block/$_dev)"
         until [[ -d sys || -d iscsi_session ]]; do
             cd ..
         done
@@ -24,14 +27,7 @@ check() {
     )

     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        _rootdev=$(find_root_block_device)
-        if [[ $_rootdev ]]; then
-            # root lives on a block device, so we can be more precise about
-            # hostonly checking
-            check_block_and_slaves is_iscsi "$_rootdev" || return 1
-        else
-            return 1
-        fi
+        for_each_host_dev_fs is_iscsi || return 1
     }
     return 0
 }

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux