* Fri Sep 29 2023 Tomas Bzatek <tbzatek@redhat.com> - 2.6-1
- Update to 2.6
This commit is contained in:
parent
75620ef422
commit
1f94235a8f
1
.gitignore
vendored
1
.gitignore
vendored
@ -30,3 +30,4 @@
|
||||
/nvme-cli-2.3.tar.gz
|
||||
/nvme-cli-2.4.tar.gz
|
||||
/nvme-cli-2.5.tar.gz
|
||||
/nvme-cli-2.6.tar.gz
|
||||
|
@ -1,103 +0,0 @@
|
||||
From 7d1c18f581e489e0cedfd9991bc97a2f8239cf82 Mon Sep 17 00:00:00 2001
|
||||
From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
|
||||
Date: Thu, 3 Aug 2023 20:21:39 +0900
|
||||
Subject: [PATCH] fabrics: Use corresponding hostid when hostnqn is generated
|
||||
|
||||
After the kernel commit ae8bd606e09b ("nvme-fabrics: prevent overriding
|
||||
of existing host"), kernel ensures hostid and hostnqn maintain 1:1
|
||||
mapping and "non 1:1 mapping will be rejected". This makes 'nvme
|
||||
discover' and 'nvme connect' commands fail when they generate hostnqn,
|
||||
since it does not use corresponding hostid.
|
||||
|
||||
To avoid the failures, prepare and use corresponding hostid to the
|
||||
generated hostnqn, taking the hostid from the hostnqn string. Also add
|
||||
checks for prepared hostnqn and hostid. If the hostid taken from the
|
||||
generated hostnqn is different from the hostid from file, print a
|
||||
warning message. Also, if the prepared hostnqn are inconsistent with the
|
||||
prepared hostid, print a warning.
|
||||
|
||||
Link: https://lore.kernel.org/linux-nvme/l7vk7fnzltpmvkwujsbf2btrzip6wh7ug62iwa3totqcda25l6@siqx7tj6lt3l/
|
||||
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
|
||||
Signed-off-by: Daniel Wagner <dwagner@suse.de>
|
||||
---
|
||||
fabrics.c | 47 +++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 45 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index 14a91cc6b..40aef6932 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -689,6 +689,43 @@ 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;
|
||||
@@ -765,10 +802,13 @@ 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;
|
||||
@@ -978,10 +1018,13 @@ 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,11 +2,11 @@
|
||||
%{!?version_no_tilde: %define version_no_tilde %{shrink:%(echo '%{version}' | tr '~' '-')}}
|
||||
|
||||
Name: nvme-cli
|
||||
Version: 2.5
|
||||
Release: 4%{?dist}
|
||||
Version: 2.6
|
||||
Release: 1%{?dist}
|
||||
Summary: NVMe management command line interface
|
||||
|
||||
License: GPLv2
|
||||
License: GPL-2.0-only
|
||||
URL: https://github.com/linux-nvme/nvme-cli
|
||||
Source0: %{url}/archive/v%{version_no_tilde}/%{name}-%{version_no_tilde}.tar.gz
|
||||
|
||||
@ -17,7 +17,7 @@ BuildRequires: systemd-rpm-macros
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: openssl-devel
|
||||
|
||||
BuildRequires: libnvme-devel >= 1.5
|
||||
BuildRequires: libnvme-devel >= 1.6
|
||||
BuildRequires: json-c-devel >= 0.13
|
||||
|
||||
BuildRequires: asciidoc
|
||||
@ -25,8 +25,6 @@ BuildRequires: xmlto
|
||||
|
||||
Requires: util-linux
|
||||
|
||||
Patch0: nvme-cli-2.6-fabrics-Use_corresponding_hostid_when_hostnqn_is_generated.patch
|
||||
|
||||
%description
|
||||
nvme-cli provides NVM-Express user space tooling for Linux.
|
||||
|
||||
@ -78,6 +76,9 @@ rm -rf %{buildroot}%{_pkgdocdir}/nvme
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Sep 29 2023 Tomas Bzatek <tbzatek@redhat.com> - 2.6-1
|
||||
- Update to 2.6
|
||||
|
||||
* Thu Aug 17 2023 Tomas Bzatek <tbzatek@redhat.com> - 2.5-4
|
||||
- Mark /etc/nvme/discovery.conf as (noreplace)
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (nvme-cli-2.5.tar.gz) = 50c557e86e95b27a0ad57779c33bbb847e12dd45c30e792f5ce1d52dedd4bc704ac25fa0af2fdebd281c9dfe0059f7ed7c1620fccfde9323f6f9a97afdf8c3cb
|
||||
SHA512 (nvme-cli-2.6.tar.gz) = da4daef2d7c554455e0c195c03f92188e0e946409a3bd8a5b421d9a106746e82fb1309901d2893639b1a3447bda094c80a9f49f59bf43cf2b00402f82beea3fc
|
||||
|
Loading…
Reference in New Issue
Block a user