]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
95zfcp_rules: simplified rd.zfcp commandline for NPIV 241/head
authorHannes Reinecke <hare@suse.de>
Thu, 10 Mar 2016 14:45:43 +0000 (15:45 +0100)
committerDaniel Molkentin <dmolkentin@suse.com>
Fri, 23 Jun 2017 19:27:48 +0000 (21:27 +0200)
When NPIV is enabled and the allow_lun_scan parameter is set to 'Y'
the HBA will initiate a LUN scan automatically, so there is no need
to specify the WWPN and LUN number manually.

References: bsc#964456

Signed-off-by: Hannes Reinecke <hare@suse.com>
dracut.cmdline.7.asc
modules.d/95zfcp_rules/module-setup.sh
modules.d/95zfcp_rules/parse-zfcp.sh

index ba7125c8c6a3df99ad90ce6f8b18ef8dacc3dc0c..63c6c10fe25e6abb28be26c096637b0e63e2909d 100644 (file)
@@ -788,12 +788,19 @@ DASD
 ZFCP
 ~~~~
 **rd.zfcp=**__<zfcp adaptor device bus ID>__,__<WWPN>__,__<FCPLUN>__::
-    rd.zfcp can be specified multiple times on the kernel command line.
+    rd.zfcp can be specified multiple times on the kernel command
+    line.
+
+**rd.zfcp=**__<zfcp adaptor device bus ID>__::
+    If NPIV is enabled and the 'allow_lun_scan' parameter to the zfcp
+    module is set to 'Y' then the zfcp adaptor will be initiating a
+    scan internally and the <WWPN> and <FCPLUN> parameters can be omitted.
 +
 [listing]
 .Example
 --
 rd.zfcp=0.0.4000,0x5005076300C213e9,0x5022000000000000
+rd.zfcp=0.0.4000
 --
 
 **rd.zfcp.conf=0**::
index b9dbd3db8809bc56436ef220ba709d85d635aa7f..fc55e69ac267018010ca919c4cfeef58c69df9c2 100755 (executable)
@@ -5,15 +5,30 @@ cmdline() {
     is_zfcp() {
         local _dev=$1
         local _devpath=$(cd -P /sys/dev/block/$_dev ; echo $PWD)
-        local _sdev _lun _wwpn _ccw
+        local _sdev _scsiid _hostno _lun _wwpn _ccw _port_type
+        local _allow_lun_scan _is_npiv
 
+        _allow_lun_scan=$(cat /sys/module/zfcp/parameters/allow_lun_scan)
         [ "${_devpath#*/sd}" == "$_devpath" ] && return 1
         _sdev="${_devpath%%/block/*}"
         [ -e ${_sdev}/fcp_lun ] || return 1
-        _lun=$(cat ${_sdev}/fcp_lun)
-        _wwpn=$(cat ${_sdev}/wwpn)
+        _scsiid="${_sdev##*/}"
+        _hostno="${_scsiid%%:*}"
+        [ -d /sys/class/fc_host/host${_hostno} ] || return 1
+        _port_type=$(cat /sys/class/fc_host/host${_hostno}/port_type)
+        case "$_port_type" in
+            NPIV*)
+                _is_npiv=1
+                ;;
+        esac
         _ccw=$(cat ${_sdev}/hba_id)
-        echo "rd.zfcp=${_ccw},${_wwpn},${_lun}"
+        if [ "$_is_npiv" ] && [ "$_allow_lun_scan" = "Y" ] ; then
+            echo "rd.zfcp=${_ccw}"
+        else
+            _lun=$(cat ${_sdev}/fcp_lun)
+            _wwpn=$(cat ${_sdev}/wwpn)
+            echo "rd.zfcp=${_ccw},${_wwpn},${_lun}"
+        fi
         return 0
     }
     [[ $hostonly ]] || [[ $mount_needs ]] && {
index 2d48716ddc9afbf7ff37c4b9a157c8216161948f..9fc681debf4566d2fff911c13ae34661eeeb415b 100755 (executable)
@@ -31,6 +31,7 @@ ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="zfcp", IMPORT{program}="collect $c
 ACTION=="add", ENV{COLLECT_$ccw}=="0", ATTR{[ccw/$ccw]online}="1"
 EOF
     fi
+    [ -z "$wwpn" -o -z "$lun" ] && return
     m=$(sed -n "/.*${wwpn}.*${lun}.*/p" $_rule)
     if [ -z "$m" ] ; then
         cat >> $_rule <<EOF