- Resolves: #2150698, handle nsid of nvmf device as hexadecimal number

- Resolves: #2150697, setup multiple device path for a nvmf boot device
This commit is contained in:
Than Ngo 2022-12-08 21:33:59 +01:00
parent 7bfab9884a
commit c5d0f03117
3 changed files with 165 additions and 1 deletions

View File

@ -0,0 +1,40 @@
commit 04e5c9646296e1f12048723bba4cee663c3f74ed
Author: Wen Xiong <wenxiong@linux.ibm.com>
Date: Thu Dec 1 05:22:37 2022 -0600
ofpathname: Handle nsid as hex in nvmf boot/install support
Didn't handle nsid correctly in nvmf boot/install support.
Need to handle it as hexadecimal number
For example,
/pci@800000020000132/fibre-channel@0,1/nvme-of/controller@50050768101935e5,ffff
:nqn=nqn.1986-03.com.ibm:nvme:2145.0000020420006CEA/namespace@26c
26c should be a hexadecimal number.
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 c576fb8..3abe4d1 100755
--- a/scripts/ofpathname
+++ b/scripts/ofpathname
@@ -809,7 +809,7 @@ l2of_nvmf()
else
goto_dir $res
devnsid=`$CAT $PWD/nsid | tr -d '\000'`
- devnsid=`echo "obase=16; $devnsid" |bc`
+ devnsid=$(printf "%x" $devnsid)
OF_PATH="$OF_PATH/namespace@$devnsid"
fi
fi
@@ -1886,7 +1886,7 @@ of2l_nvmf()
for dev_name in `$FIND /sys/block -name "${ana_name##*/}n[0-9]*"`; do
cd $dev_name
local devnsid=`$CAT ./nsid 2>/dev/null`
- devnsid=`echo "obase=16; $devnsid" |bc`
+ devnsid=$(printf "%x" $devnsid)
if [[ $devnsid = $nsid ]]; then
found=1
NS_ID="${dev_name##*n}"

View File

@ -0,0 +1,118 @@
commit 3847a1c25a640394c4afd2b8938ad21190bf5dbe
Author: Wen Xiong <wenxiong@linux.ibm.com>
Date: Fri Oct 28 09:20:38 2022 -0500
Support multiple dev paths for a nvmf boot device
This patch adds the support for multiple dev/of paths with a nvmf boot dev
# bootlist -m normal -o nvme1n4
nvme1n4
nvme3n4
nvme5n4
nvme6n4
# bootlist -m normal -o
nvme1n4
nvme3n4
nvme5n4
nvme6n4
# bootlist -m normal -r
/pci@800000020000017/fibre-channel@0/nvme-of/controller@50050768101935e5,ffff:nqn=nqn.1986-03.com.ibm:nvme:2145.0000020420006CEA/namespace@147
/pci@800000020000017/fibre-channel@0/nvme-of/controller@5005076810193675,ffff:nqn=nqn.1986-03.com.ibm:nvme:2145.0000020420006CEA/namespace@147
/pci@800000020000017/fibre-channel@0,1/nvme-of/controller@5005076810193675,ffff:nqn=nqn.1986-03.com.ibm:nvme:2145.0000020420006CEA/namespace@147
/pci@800000020000017/fibre-channel@0,1/nvme-of/controller@50050768101935e5,ffff:nqn=nqn.1986-03.com.ibm:nvme:2145.0000020420006CEA/namespace@147
Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
diff --git a/scripts/bootlist b/scripts/bootlist
index 1929f65..cc8718e 100755
--- a/scripts/bootlist
+++ b/scripts/bootlist
@@ -327,16 +327,10 @@ add_nvmf()
cd $dir
link=`get_link "device"`
cd $link
- for slave in $PWD/*; do
- slavedev=${slave##*/}
- if [[ "$slavedev" == nvme[0-9]* ]] ; then
- cd $slave
- res=`$FIND . -name "${ctrl_name}*"`
- if [[ ${#res} != 0 ]]; then
- LOGICAL_NAMES[$ctr]=${slavedev}
- ctr=$[$ctr + 1]
- fi
- fi
+ for slave in `ls -d $PWD/nvme*`; do
+ slavedev=${slave##*/}
+ LOGICAL_NAMES[$ctr]=${slavedev}
+ ctr=$[$ctr + 1]
done
done
@@ -502,11 +496,17 @@ while [[ -n $1 ]]; do
ctrl_name="${ctrl_name%n[0-9]*}"
is_nvmf=$(is_nvmf_device $ctrl_name)
if [[ $is_nvmf = "yes" ]]; then
- if [[ "$1" == *"nvme-of"* ]]; then
- master_of_path=$1
- else
- master_of_path=`get_of_device_name $1`
- fi
+ if [[ "$1" == *"nvme-of"* ]]; then
+ master_of_path=$1
+ else
+ master_of_path=`get_of_device_name $1`
+ fi
+
+ if [[ -z $master_of_path ]]; then
+ echo "Device $1 does not appear to be valid." >&2
+ exit 1
+ fi
+
namespace_base=${master_of_path##*/}
DEVTYPE="nvme-of"
add_nvmf $ctrl_name
diff --git a/scripts/ofpathname b/scripts/ofpathname
index 33d7702..c576fb8 100755
--- a/scripts/ofpathname
+++ b/scripts/ofpathname
@@ -1875,19 +1875,28 @@ of2l_nvmf()
fi
done
+ local ana_dir
if [[ -n $LOGICAL_DEVNAME ]] && \
[[ -n $nsid ]]; then
- 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
+ for ana_dir in `$FIND /sys/devices/virtual/nvme-fabrics -name "$LOGICAL_DEVNAME"`; do
+ cd $ana_dir
+ link=`get_link "device"`
+ cd $link
+ for ana_name in `ls -d $PWD/nvme*`; do
+ for dev_name in `$FIND /sys/block -name "${ana_name##*/}n[0-9]*"`; do
+ cd $dev_name
+ local devnsid=`$CAT ./nsid 2>/dev/null`
+ devnsid=`echo "obase=16; $devnsid" |bc`
+ if [[ $devnsid = $nsid ]]; then
+ found=1
+ NS_ID="${dev_name##*n}"
+ LOGICAL_DEVNAME="${LOGICAL_DEVNAME}n${NS_ID}"
+ break
+ fi
+ done
+ done
done
+
if [[ $found -eq 0 ]]; then
LOGICAL_DEVNAME=""
fi

View File

@ -1,6 +1,6 @@
Name: powerpc-utils
Version: 1.3.10
Release: 3%{?dist}
Release: 4%{?dist}
Summary: PERL-based scripts for maintaining and servicing PowerPC systems
License: GPLv2
@ -15,6 +15,8 @@ Patch4: powerpc-utils-e1f1de-lmb_address_in_hexadecimal.patch
# bz#2110129, Add NVMf-FC boot support for Power - powerpc-utils
Patch5: powerpc-utils-c01580-add_NVMf-FC_boot_support_part1.patch
Patch6: powerpc-utils-2fbd7c-add_NVMf-FC_boot_support_part2.patch
Patch7: powerpc-utils-git3847a1-support_multiple_dev_paths_for_a_nvmf_boot_device.patch
Patch8: powerpc-utils-git04e5c9-handle_nsid_as_hex.patch
ExclusiveArch: ppc %{power64}
@ -204,6 +206,10 @@ systemctl enable hcn-init.service >/dev/null 2>&1 || :
%changelog
* Thu Dec 08 2022 Than Ngo <than@redhat.com> - 1.3.10-4
- Resolves: #2150698, handle nsid of nvmf device as hexadecimal number
- Resolves: #2150697, setup multiple device path for a nvmf boot device
* Thu Nov 03 2022 Than Ngo <than@redhat.com> - 1.3.10-3
- Resolves: #2111991, Add udev rule for the nx-gzip in to the core subpackage
- Resolves: #2121470, Fix lsslot -c mem output when using 4GB LMB size