From e4c695eeb7301b5d0f564e081d2f40e5bf22bfbb Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Thu, 21 Sep 2023 14:31:07 +0200 Subject: [PATCH 1/3] fix(nvmf): move /etc/nvme/host{nqn,id} requirement to hostonly When creating initramfs for universal boot image such as an installer, we can't include any machine-specific IDs. Let's move the check for /etc/nvme/hostnqn and /etc/nvme/hostid files presence to the hostonly section to avoid unsatisfied requirements. Signed-off-by: Tomas Bzatek (cherry picked from commit https://github.com/dracut-ng/dracut-ng/commit/54cd647932c42e5520a8bcdd3e5882210e4603c5) --- modules.d/95nvmf/module-setup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh index a8f3034143..6a1e3f5bcb 100755 --- a/modules.d/95nvmf/module-setup.sh +++ b/modules.d/95nvmf/module-setup.sh @@ -3,8 +3,6 @@ # called by dracut check() { require_binaries nvme jq || return 1 - [ -f /etc/nvme/hostnqn ] || return 255 - [ -f /etc/nvme/hostid ] || return 255 is_nvmf() { local _dev=$1 @@ -36,6 +34,8 @@ check() { } [[ $hostonly ]] || [[ $mount_needs ]] && { + [ -f /etc/nvme/hostnqn ] || return 255 + [ -f /etc/nvme/hostid ] || return 255 pushd . > /dev/null for_each_host_dev_and_slaves is_nvmf local _is_nvmf=$? @@ -130,8 +130,8 @@ install() { _nvmf_args=$(cmdline) [[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf" fi - inst_simple "/etc/nvme/hostnqn" - inst_simple "/etc/nvme/hostid" + inst_simple -H "/etc/nvme/hostnqn" + inst_simple -H "/etc/nvme/hostid" inst_multiple ip sed From 927efd27050be7ee875b6f709215e2c10b1c6dda Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Fri, 6 Sep 2024 13:36:41 +0200 Subject: [PATCH 2/3] fix(nvmf): require NVMeoF modules Signed-off-by: Martin Wilck (cherry picked from commit https://github.com/dracut-ng/dracut-ng/commit/4133270236f99d2196b2c1d05dfab76aae2f8092) bsc#1230468 --- modules.d/95nvmf/module-setup.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh index 6a1e3f5bcb..284a45489a 100755 --- a/modules.d/95nvmf/module-setup.sh +++ b/modules.d/95nvmf/module-setup.sh @@ -2,7 +2,10 @@ # called by dracut check() { + local -A nvmf_trtypes + require_binaries nvme jq || return 1 + require_kernel_modules nvme_fabrics || return 1 is_nvmf() { local _dev=$1 @@ -20,7 +23,12 @@ check() { break fi done - [[ $trtype == "fc" ]] || [[ $trtype == "tcp" ]] || [[ $trtype == "rdma" ]] + if [[ $trtype == "fc" ]] || [[ $trtype == "tcp" ]] || [[ $trtype == "rdma" ]]; then + nvmf_trtypes["nvme_${trtype}"]=1 + return 0 + else + return 1 + fi } has_nbft() { @@ -41,6 +49,7 @@ check() { local _is_nvmf=$? popd > /dev/null || exit [[ $_is_nvmf == 0 ]] || return 255 + require_kernel_modules "${!nvmf_trtypes[@]}" || return 1 if [ ! -f /sys/class/fc/fc_udev_device/nvme_discovery ] \ && [ ! -f /etc/nvme/discovery.conf ] \ && [ ! -f /etc/nvme/config.json ] && ! has_nbft; then From 622265467c0d73b4bd65d9d38135bd0415d2dc9d Mon Sep 17 00:00:00 2001 From: Martin Wilck Date: Mon, 9 Sep 2024 09:43:01 +0200 Subject: [PATCH 3/3] fix(nvmf): install (only) required nvmf modules nvme_rdma was not installed, even if it was required, whereas nvme_tcp was installed in non-TCP setups. nvme_fabrics will be pulled in automatically by any transport module and doesn't need to be installed explicitly. Fix it. (cherry picked from commit https://github.com/dracut-ng/dracut-ng/commit/3748ed4db5255c516cd60c2d710532d79878a498) --- modules.d/95nvmf/module-setup.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh index 284a45489a..bb63ffea4f 100755 --- a/modules.d/95nvmf/module-setup.sh +++ b/modules.d/95nvmf/module-setup.sh @@ -68,8 +68,9 @@ depends() { # called by dracut installkernel() { - instmods nvme_fc lpfc qla2xxx - hostonly="" instmods nvme_tcp nvme_fabrics 8021q + instmods nvme_fc nvme_tcp nvme_rdma lpfc qla2xxx + # 802.1q VLAN may be set up in Firmware later. Include the module always. + hostonly="" instmods 8021q } # called by dracut