111 lines
3.6 KiB
Diff
111 lines
3.6 KiB
Diff
commit 2fbd7c1ff428e534d80f60e03501d625ab594eca
|
|
Author: Wen Xiong <wenxiong@linux.ibm.com>
|
|
Date: Wed Jun 15 13:05:51 2022 -0500
|
|
|
|
ofpathname: Fix several issues in nvmf boot/install support
|
|
|
|
This patch fixes several issues in boot/install over nvme-over-fc
|
|
device support.
|
|
|
|
- change cntlid to ffff
|
|
- add devnisd from sysfs
|
|
- add subsysnqn
|
|
|
|
Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
|
|
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
|
|
|
|
diff --git a/scripts/ofpathname b/scripts/ofpathname
|
|
index b1d6b09..33d7702 100755
|
|
--- a/scripts/ofpathname
|
|
+++ b/scripts/ofpathname
|
|
@@ -773,8 +773,7 @@ l2of_nvmf()
|
|
t_wwpn="${t_wwpn#0x}"
|
|
t_wwpn="${t_wwpn%,*}"
|
|
nqn=`$CAT $PWD/subsysnqn`
|
|
- cntlid_dec=`$CAT $PWD/cntlid`
|
|
- cntlid=`echo "obase=16; $cntlid_dec" |bc`
|
|
+ cntlid=`echo ffff`
|
|
if [[ -n $h_wwpn ]]; then
|
|
for f in `$FIND /sys/devices -name "port_name"`; do
|
|
sys_wwpn=`$CAT $f 2>/dev/null`
|
|
@@ -808,6 +807,9 @@ l2of_nvmf()
|
|
if [[ ${#res} = 0 ]]; then
|
|
OF_PATH=""
|
|
else
|
|
+ goto_dir $res
|
|
+ devnsid=`$CAT $PWD/nsid | tr -d '\000'`
|
|
+ devnsid=`echo "obase=16; $devnsid" |bc`
|
|
OF_PATH="$OF_PATH/namespace@$devnsid"
|
|
fi
|
|
fi
|
|
@@ -818,6 +820,8 @@ l2of_nvmf()
|
|
if [[ ${#res} = 0 ]]; then
|
|
OF_PATH=""
|
|
else
|
|
+ goto_dir $res
|
|
+ devpart=`$CAT $PWD/partition | tr -d '\000'`
|
|
OF_PATH="${OF_PATH}:${devpart}"
|
|
fi
|
|
fi
|
|
@@ -1826,8 +1830,7 @@ of2l_nvmf()
|
|
ctrl_name=`echo $DEVNAME | cut -d "/" -f 5`
|
|
OF_WWPN=${ctrl_name%,*}
|
|
OF_WWPN=${OF_WWPN#*@}
|
|
- of_cntlid=${ctrl_name%%:*}
|
|
- of_cntlid=${of_cntlid#*,}
|
|
+ OF_NQN=`echo $ctrl_name | cut -d "=" -f 2`
|
|
# set partition number only if ':' is present
|
|
case "${nsid_part}" in
|
|
*:*)
|
|
@@ -1835,6 +1838,7 @@ of2l_nvmf()
|
|
;;
|
|
esac
|
|
local dir
|
|
+ local found=0
|
|
|
|
for dir in `$FIND /sys/devices/virtual/nvme-fabrics -name "nvme[0-9]*"`; do
|
|
cd $dir
|
|
@@ -1844,10 +1848,9 @@ of2l_nvmf()
|
|
t_wwpn="${t_wwpn%,*}"
|
|
h_wwpn=`$CAT $PWD/address | cut -f 5 -d "-"`
|
|
h_wwpn="${h_wwpn#0x}"
|
|
- cntlid_dec=`$CAT $PWD/cntlid 2>/dev/null`
|
|
- cntlid=`echo "obase=16; $cntlid_dec" |bc`
|
|
+ nqn=`$CAT $PWD/subsysnqn`
|
|
if [[ $t_wwpn = $OF_WWPN ]] && \
|
|
- [[ $cntlid == $of_cntlid ]]; then
|
|
+ [[ $nqn == $OF_NQN ]]; then
|
|
for f in `$FIND /sys/devices -name "port_name"`; do
|
|
sys_wwpn=`$CAT $f 2>/dev/null`
|
|
sys_wwpn="${sys_wwpn#0x}"
|
|
@@ -1871,14 +1874,23 @@ of2l_nvmf()
|
|
fi
|
|
fi
|
|
done
|
|
+
|
|
if [[ -n $LOGICAL_DEVNAME ]] && \
|
|
[[ -n $nsid ]]; then
|
|
- res=`$FIND /sys/devices/virtual -name ${LOGICAL_DEVNAME}n${nsid}`
|
|
- if [[ ${#res} = 0 ]]; then
|
|
- LOGICAL_DEVNAME=''
|
|
- else
|
|
- LOGICAL_DEVNAME="${LOGICAL_DEVNAME}n${nsid}"
|
|
- fi
|
|
+ for dir in `$FIND /sys/block -name "${LOGICAL_DEVNAME}n[0-9]*"`; do
|
|
+ cd $dir
|
|
+
|
|
+ local devnsid=`$CAT ./nsid 2>/dev/null`
|
|
+ devnsid=`echo "obase=16; $devnsid" |bc`
|
|
+ if [[ $devnsid = $nsid ]]; then
|
|
+ found=1
|
|
+ LOGICAL_DEVNAME="${dir##*/}"
|
|
+ break
|
|
+ fi
|
|
+ done
|
|
+ if [[ $found -eq 0 ]]; then
|
|
+ LOGICAL_DEVNAME=""
|
|
+ fi
|
|
fi
|
|
|
|
if [[ -n $LOGICAL_DEVNAME ]] && \
|