Compare commits

...

2 Commits

Author SHA1 Message Date
Maurizio Lombardi 1f66dbfc11 Revert 1:1 mapping between hostnqn and hostid 2023-11-21 03:42:05 +00:00
Maurizio Lombardi 4e68270f1e udev rule enhancements for NetApp target
Resolves: RHEL-12566

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
2023-11-09 11:49:31 +01:00
5 changed files with 188 additions and 2 deletions

1
.nvme-cli.metadata Normal file
View File

@ -0,0 +1 @@
01d2a5755d0d251eafeeefad27e739353f9e0f12 nvme-cli-2.6.tar.gz

View File

@ -0,0 +1,29 @@
From 0782167f3a6709df232b746cdfa2a036c6207f7f Mon Sep 17 00:00:00 2001
From: Martin George <marting@netapp.com>
Date: Tue, 3 Oct 2023 16:05:23 +0530
Subject: [PATCH] udev-rules: set ctrl_loss_tmo to -1 for ONTAP NVMe/TCP
Setting ctrl_loss_tmo to -1 for ONTAP NVMe/TCP controllers would enable
indefinite reconnect attempts during a path loss and help avoid purging
the path on the host, which otherwise may lead to mounted fs read-only
behavior. So add a rule towards enabling the same.
Signed-off-by: Martin George <marting@netapp.com>
---
nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in | 3 +++
1 file changed, 3 insertions(+)
diff --git a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in b/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in
index 299fe2251418..99b6a8ba0bf8 100644
--- a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in
+++ b/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in
@@ -1,3 +1,6 @@
# Enable round-robin for NetApp ONTAP and NetApp E-Series
ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp ONTAP Controller", ATTR{iopolicy}="round-robin"
ACTION=="add", SUBSYSTEM=="nvme-subsystem", ATTR{subsystype}=="nvm", ATTR{model}=="NetApp E-Series", ATTR{iopolicy}="round-robin"
+
+# Set ctrl_loss_tmo to -1 for NetApp ONTAP NVMe/TCP
+ACTION!="remove", SUBSYSTEM=="nvme", KERNEL=="nvme*", ATTR{transport}=="tcp", ATTR{model}=="NetApp ONTAP Controller", ATTR{ctrl_loss_tmo}="-1"
--
2.39.3

View File

@ -0,0 +1,50 @@
From 748a9ac050fb443b1204d06ce3b5b129b6a8afe2 Mon Sep 17 00:00:00 2001
From: Martin George <marting@netapp.com>
Date: Thu, 5 Oct 2023 12:12:46 +0530
Subject: [PATCH] udev-rules: rename netapp udev rule
Rename 71-nvmf-iopolicy-netapp.rules.in to 71-nvmf-netapp.rules.in
so as to make the name generic, since this not only sets the
iopolicy here but also modifies the ctrl_loss_tmo.
Signed-off-by: Martin George <marting@netapp.com>
---
meson.build | 2 +-
nvme.spec.in | 2 +-
...71-nvmf-iopolicy-netapp.rules.in => 71-nvmf-netapp.rules.in} | 0
3 files changed, 2 insertions(+), 2 deletions(-)
rename nvmf-autoconnect/udev-rules/{71-nvmf-iopolicy-netapp.rules.in => 71-nvmf-netapp.rules.in} (100%)
diff --git a/meson.build b/meson.build
index 3d3fb08541ff..310ba1f83400 100644
--- a/meson.build
+++ b/meson.build
@@ -236,7 +236,7 @@ endforeach
udev_files = [
'70-nvmf-autoconnect.rules',
- '71-nvmf-iopolicy-netapp.rules',
+ '71-nvmf-netapp.rules',
]
foreach file : udev_files
diff --git a/nvme.spec.in b/nvme.spec.in
index fe4675a7bb0b..3eab9ff030ff 100644
--- a/nvme.spec.in
+++ b/nvme.spec.in
@@ -31,7 +31,7 @@ touch %{buildroot}@SYSCONFDIR@/nvme/hostid
@SYSCONFDIR@/nvme/discovery.conf
%ghost @SYSCONFDIR@/nvme/config.json
@UDEVRULESDIR@/70-nvmf-autoconnect.rules
-@UDEVRULESDIR@/71-nvmf-iopolicy-netapp.rules
+@UDEVRULESDIR@/71-nvmf-netapp.rules
@DRACUTRILESDIR@/70-nvmf-autoconnect.conf
@SYSTEMDDIR@/nvmf-connect@.service
@SYSTEMDDIR@/nvmefc-boot-connections.service
diff --git a/nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in b/nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in
similarity index 100%
rename from nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules.in
rename to nvmf-autoconnect/udev-rules/71-nvmf-netapp.rules.in
--
2.39.3

View File

@ -0,0 +1,92 @@
From 5f872e9c1689078bf2c4e33108c1514da1a91497 Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Mon, 13 Nov 2023 10:49:35 +0100
Subject: [PATCH] Revert "fabrics: Use corresponding hostid when hostnqn is
generated"
This reverts commit 7d1c18f581e489e0cedfd9991bc97a2f8239cf82.
---
fabrics.c | 47 ++---------------------------------------------
1 file changed, 2 insertions(+), 45 deletions(-)
diff --git a/fabrics.c b/fabrics.c
index 57ca927fce9a..f4fb63f0c555 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -616,43 +616,6 @@ static int nvme_read_volatile_config(nvme_root_t r)
return ret;
}
-char *nvmf_hostid_from_hostnqn(const char *hostnqn)
-{
- const char *uuid;
-
- if (!hostnqn)
- return NULL;
-
- uuid = strstr(hostnqn, "uuid:");
- if (!uuid)
- return NULL;
-
- return strdup(uuid + strlen("uuid:"));
-}
-
-void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn)
-{
- char *hostid_from_file, *hostid_from_hostnqn;
-
- if (!hostid)
- return;
-
- hostid_from_file = nvmf_hostid_from_file();
- if (hostid_from_file && strcmp(hostid_from_file, hostid)) {
- fprintf(stderr, "warning: use generated hostid instead of hostid file\n");
- free(hostid_from_file);
- }
-
- if (!hostnqn)
- return;
-
- hostid_from_hostnqn = nvmf_hostid_from_hostnqn(hostnqn);
- if (hostid_from_hostnqn && strcmp(hostid_from_hostnqn, hostid)) {
- fprintf(stderr, "warning: use hostid which does not match uuid in hostnqn\n");
- free(hostid_from_hostnqn);
- }
-}
-
int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
{
char *subsysnqn = NVME_DISC_SUBSYS_NAME;
@@ -729,13 +692,10 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
hostid_arg = hostid;
if (!hostnqn)
hostnqn = hnqn = nvmf_hostnqn_from_file();
- if (!hostnqn) {
+ if (!hostnqn)
hostnqn = hnqn = nvmf_hostnqn_generate();
- hostid = hid = nvmf_hostid_from_hostnqn(hostnqn);
- }
if (!hostid)
hostid = hid = nvmf_hostid_from_file();
- nvmf_check_hostid_and_hostnqn(hostid, hostnqn);
h = nvme_lookup_host(r, hostnqn, hostid);
if (!h) {
ret = ENOMEM;
@@ -946,13 +906,10 @@ int nvmf_connect(const char *desc, int argc, char **argv)
if (!hostnqn)
hostnqn = hnqn = nvmf_hostnqn_from_file();
- if (!hostnqn) {
+ if (!hostnqn)
hostnqn = hnqn = nvmf_hostnqn_generate();
- hostid = hid = nvmf_hostid_from_hostnqn(hostnqn);
- }
if (!hostid)
hostid = hid = nvmf_hostid_from_file();
- nvmf_check_hostid_and_hostnqn(hostid, hostnqn);
h = nvme_lookup_host(r, hostnqn, hostid);
if (!h) {
errno = ENOMEM;
--
2.39.3

View File

@ -3,13 +3,17 @@
Name: nvme-cli
Version: 2.6
Release: 2%{?dist}
Release: 4%{?dist}
Summary: NVMe management command line interface
License: GPL-2.0-only
URL: https://github.com/linux-nvme/nvme-cli
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch0: 0001-udev-rules-set-ctrl_loss_tmo-to-1-for-ONTAP-NVMe-TCP.patch
Patch1: 0002-udev-rules-rename-netapp-udev-rule.patch
Patch2: 0003-Revert-fabrics-Use-corresponding-hostid-when-hostnqn.patch
BuildRequires: meson >= 0.50.0
BuildRequires: gcc gcc-c++
BuildRequires: libuuid-devel
@ -30,6 +34,10 @@ nvme-cli provides NVM-Express user space tooling for Linux.
#%%setup -qn %%{name}-%%{commit0}
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
%meson -Dudevrulesdir=%{_udevrulesdir} -Dsystemddir=%{_unitdir} -Ddocs=all -Ddocs-build=true -Dhtmldir=%{_pkgdocdir}
%meson_build
@ -60,7 +68,7 @@ rm -rf %{buildroot}%{_pkgdocdir}/nvme
%{_unitdir}/nvmf-connect.target
%{_unitdir}/nvmf-connect@.service
%{_udevrulesdir}/70-nvmf-autoconnect.rules
%{_udevrulesdir}/71-nvmf-iopolicy-netapp.rules
%{_udevrulesdir}/71-nvmf-netapp.rules
# Do not install the dracut rule yet. See rhbz 1742764
# Is this still true? Now that we support nvme-of boot, do we want to install this file?
# /usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf
@ -84,6 +92,12 @@ if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
fi
%changelog
* Mon Nov 13 2023 Maurizio Lombardi <mlombard@redhat.com> - 2.6-4
- Fix for RHEL-16216 (revert 1:1 mapping between hostnqn and hostid)
* Wed Nov 08 2023 Maurizio Lombardi <mlombard@redhat.com> - 2.6-3
- Fixes for RHEL-12566
* Mon Nov 06 2023 Maurizio Lombardi <mlombard@redhat.com> - 2.6-2
- Rebuild for side-tag