Resolves: RHEL-22830, Support multiple dev paths for a nvme boot device

This commit is contained in:
Than Ngo 2024-01-30 15:54:16 +01:00 committed by root
parent 3df7023995
commit 406c7c01bd
3 changed files with 178 additions and 1 deletions

1
.powerpc-utils.metadata Normal file
View File

@ -0,0 +1 @@
4596fced545f3c751ff2665663baaed0db7ab7ce powerpc-utils-1.3.10.tar.gz

View File

@ -0,0 +1,171 @@
From edf7ee0e03e60140bcbe34ec458e1361678a5dd2 Mon Sep 17 00:00:00 2001
From: Wen Xiong <wenxiong@linux.ibm.com>
Date: Thu, 25 Jan 2024 23:49:21 -0500
Subject: [PATCH] scripts/bootlist: Support multiple dev paths for a nvme boot
device
Multipath splitter drawer is going to support two physical paths for
each nvme device.
This patch adds the support for multiple device/of paths for a nvme boot
device.
For example,
U50EE.001.WZS000E-P3-C1-R1 U.2 PCI-E capable, Rev 4, 4x lanes with 2x
lanes connected 0581:10:00.0
U50EE.001.WZS000E-P3-C1-R2 U.2 PCI-E capable, Rev 4, 4x lanes with 2x
lanes connected 0521:10:00.0
nvme-subsys1 -
NQN=nqn.1994-11.com.samsung:nvme:PM1735a:2.5-inch:S6RUNE0R900042
hostnqn=nqn.2014-08.org.nvmexpress:uuid:3c6c1ace-e9b1-4a17-8ff0-6a84d3dd15f4
iopolicy=numa
\
+- nvme1 pcie 0523:20:00.0 live
+- nvme0 pcie 0583:20:00.0 live
Node Generic SN Model
Namespace Usage Format FW Rev
--------------------- --------------------- --------------------
---------------------------------------- ----------
-------------------------- ---------------- --------
/dev/nvme1n1 /dev/ng1n1 S6RUNE0R900042 1.6TB
NVMe Gen4 U.2 SSD III 0x1 1.60 TB / 1.60 TB
4 KiB + 0 B REV.SN66
nvme0
nvme1n1
/pci@800000020000583/pci1014,6bc@0/namespace@1
/pci@800000020000523/pci1014,6bc@0/namespace@1
Signed-off-by: Wen Xiong <wenxiong@linux.ibm.com>
---
scripts/bootlist | 80 +++++++++++++++++++++++++++++++++++++++---------
1 file changed, 66 insertions(+), 14 deletions(-)
diff --git a/scripts/bootlist b/scripts/bootlist
index cc8718e..dcb5c00 100755
--- a/scripts/bootlist
+++ b/scripts/bootlist
@@ -304,6 +304,21 @@ is_nvmf_device()
fi
}
+# is_multipath_nvme_device
+# Check to see if this is a multipath nvme device
+#
+is_multipath_nvme_device()
+{
+ local res
+
+ res=`$FIND /sys/devices/virtual/nvme-subsystem -name $1 2>/dev/null`
+ if [[ ${#res} = 0 ]]; then
+ echo "no"
+ else
+ echo "yes"
+ fi
+}
+
# get_link
# return the directory path that a link points to.
# The only parameter is the link name.
@@ -340,6 +355,32 @@ add_nvmf()
fi
}
+add_multipath_nvme()
+{
+ local DEVNAME=$1
+
+ ctrl_name=$DEVNAME
+ local startctr=$ctr
+
+ local dir
+ for dir in `$FIND /sys/devices/virtual/nvme-subsystem -name "$ctrl_name"`; do
+ cd $dir
+ cd ..
+ for slave in `ls -d $PWD/nvme*`; do
+ slavedev=${slave##*/}
+ if [[ "$slavedev" != *nvme*n* ]] ; then
+ LOGICAL_NAMES[$ctr]=${slavedev}
+ ctr=$[$ctr + 1]
+ fi
+ done
+ done
+
+ if [[ "$startctr" = "$ctr" ]] ; then
+ LOGICAL_NAMES[$ctr]=$1
+ ctr=$[$ctr + 1]
+ fi
+}
+
add_logical()
{
local DEVNAME=$1
@@ -487,31 +528,40 @@ while [[ -n $1 ]]; do
if [[ "$1" == *"dm-"* ]] ; then
add_logical $1
else
- if [[ "$1" == *"nvme-of"* ]]; then
+ if [[ "$1" == *"nvme-of"* ]] || [[ "$1" == *"namespace"* ]]; then
ctrl_name=`get_logical_device_name $1`
+ master_of_path=$1
else
ctrl_name=$1
ctrl_name=${ctrl_name##*/}
+ 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
+
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 [[ -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
else
- add_logical $1
+ is_multipath_nvme=$(is_multipath_nvme_device $ctrl_name)
+ if [[ $is_multipath_nvme = "yes" ]]; then
+ if [[ "$master_of_path" == *namespace* ]] ; then
+ namespace_base=${master_of_path##*/}
+ else
+ echo "Device $1 does not appear to be valid." >&2
+ exit 1
+ fi
+ DEVTYPE="multi-nvme"
+ add_multipath_nvme $ctrl_name
+ else
+ add_logical $1
+ fi
fi
fi
fi
@@ -534,8 +584,10 @@ if [[ ${#LOGICAL_NAMES[*]} -ne 0 ]]; then
if [[ -z ${OF_DEVPATH[$ctr]} ]]; then
# See if this is an OF pathname
OF_DEVPATH[$ctr]=`get_of_device_name ${LOGICAL_NAMES[$ctr]}`
- if [[ $DEVTYPE = "nvme-of" ]]; then
+ if [[ $DEVTYPE = "nvme-of" ]] || [[ $DEVTYPE = "multi-nvme" ]]; then
OF_DEVPATH[$ctr]=${OF_DEVPATH[$ctr]}/$namespace_base
+ else
+ OF_DEVPATH[$ctr]=${OF_DEVPATH[$ctr]}
fi
else
OF_DEVPATH[$ctr]=${LOGICAL_NAMES[$ctr]}
--
2.35.3

View File

@ -1,6 +1,6 @@
Name: powerpc-utils
Version: 1.3.10
Release: 9%{?dist}
Release: 10%{?dist}
Summary: PERL-based scripts for maintaining and servicing PowerPC systems
License: GPLv2
@ -49,6 +49,8 @@ Patch21: powerpc-utils-7698adc945372e901c2bc3f7066a5a1c219bf1d8.patch
Patch22: powerpc-utils-8a7aa61c5f520df03e53e6f7e1d63b7d5c432376.patch
# rtas_dbg -l returns large negativ value
Patch23: powerpc-utils-rtas_dbg_return_negativ_value.patch
# Support multiple dev paths for a nvme boot device
Patch24: 0001-scripts-bootlist-Support-multiple-dev-paths-for-a-nv.patch
ExclusiveArch: ppc %{power64}
@ -243,6 +245,9 @@ systemctl enable hcn-init.service >/dev/null 2>&1 || :
%changelog
* Tue Jan 30 2024 Than Ngo <than@redhat.com> - 1.3.10-10
- Resolves: RHEL-22830, Support multiple dev paths for a nvme boot device
* Wed Jan 10 2024 Than Ngo <than@redhat.com> - 1.3.10-9
- Resolves: RHEL-20350, getting larger Negative value while running rtas_dbg -l
- Resolves: RHEL-19076, installation fails if nsid of nvme device is greater than 10