* Mon Apr 04 2022 Tomas Bzatek <tbzatek@redhat.com> - 2.0~rc8-1
- Update to 2.0-rc8 - Added scriptlet to generate /etc/nvme/hostnqn and hostid files (#2065886)
This commit is contained in:
parent
3f66b131c2
commit
726694821c
1
.gitignore
vendored
1
.gitignore
vendored
@ -20,3 +20,4 @@
|
||||
/nvme-cli-2.0-rc4.tar.gz
|
||||
/nvme-cli-2.0-rc5.tar.gz
|
||||
/nvme-cli-2.0-rc6.tar.gz
|
||||
/nvme-cli-2.0-rc8.tar.gz
|
||||
|
@ -1,25 +0,0 @@
|
||||
commit 9ec18159f75512687a3df22eee15fbafc4c87c9a
|
||||
Author: Tomas Bzatek <tbzatek@redhat.com>
|
||||
Date: Mon Mar 14 18:15:20 2022 +0100
|
||||
|
||||
connect: Set errno to zero on nvmf_add_ctrl() success
|
||||
|
||||
The libnvme's nvmf_add_ctrl() might return zero (success) while
|
||||
having errno set to a non-zero value due to lots of calls inside.
|
||||
And since nvmf_connect() returns errno primarily, make sure
|
||||
it's zeroed on success.
|
||||
|
||||
See related https://github.com/linux-nvme/libnvme/pull/292
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index 49378dc..e08ffd6 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -688,6 +688,7 @@ int nvmf_connect(const char *desc, int argc, char **argv)
|
||||
fprintf(stderr, "no controller found: %s\n",
|
||||
nvme_strerror(errno));
|
||||
else {
|
||||
+ errno = 0;
|
||||
if (flags == NORMAL)
|
||||
print_connect_msg(c);
|
||||
else if (flags == JSON)
|
84
nvme-cli-2.0-rc9_fabrics_Do_not_free_static_string.patch
Normal file
84
nvme-cli-2.0-rc9_fabrics_Do_not_free_static_string.patch
Normal file
@ -0,0 +1,84 @@
|
||||
commit 539cc29a7cb290523652ea0cdfe0afb1affd0bf4
|
||||
Author: Daniel Wagner <dwagner@suse.de>
|
||||
Date: Mon Apr 4 12:48:55 2022 +0200
|
||||
|
||||
fabrics: Do not free static string
|
||||
|
||||
38f5a54a7306 ("fabrics: Support connect even when no /etc/nvme/hostnqn
|
||||
file exists") introduce a regression. arg_parser() might assign a
|
||||
static string to hostnqn and/or hostid. Can't free this.
|
||||
|
||||
Signed-off-by: Daniel Wagner <dwagner@suse.de>
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index 30388f2d..76d78a91 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -505,6 +505,7 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
char *hostnqn = NULL, *hostid = NULL, *hostkey = NULL, *ctrlkey = NULL;
|
||||
char *transport = NULL, *traddr = NULL, *trsvcid = NULL;
|
||||
char *config_file = PATH_NVMF_CONFIG;
|
||||
+ char *hnqn = NULL, *hid = NULL;
|
||||
enum nvme_print_flags flags;
|
||||
nvme_root_t r;
|
||||
nvme_host_t h;
|
||||
@@ -559,11 +560,11 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
set_discovery_kato(&cfg);
|
||||
|
||||
if (!hostnqn)
|
||||
- hostnqn = nvmf_hostnqn_from_file();
|
||||
+ hostnqn = hnqn = nvmf_hostnqn_from_file();
|
||||
if (!hostnqn)
|
||||
- hostnqn = nvmf_hostnqn_generate();
|
||||
+ hostnqn = hnqn = nvmf_hostnqn_generate();
|
||||
if (!hostid)
|
||||
- hostid = nvmf_hostid_from_file();
|
||||
+ hostid = hid = nvmf_hostid_from_file();
|
||||
h = nvme_lookup_host(r, hostnqn, hostid);
|
||||
if (!h) {
|
||||
ret = ENOMEM;
|
||||
@@ -658,8 +659,8 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
out_free_ctrl:
|
||||
nvme_free_ctrl(c);
|
||||
out_free:
|
||||
- free(hostnqn);
|
||||
- free(hostid);
|
||||
+ free(hnqn);
|
||||
+ free(hid);
|
||||
if (dump_config)
|
||||
nvme_dump_config(r);
|
||||
nvme_free_tree(r);
|
||||
@@ -673,6 +674,7 @@ int nvmf_connect(const char *desc, int argc, char **argv)
|
||||
char *transport = NULL, *traddr = NULL;
|
||||
char *trsvcid = NULL, *hostnqn = NULL, *hostid = NULL;
|
||||
char *hostkey = NULL, *ctrlkey = NULL;
|
||||
+ char *hnqn = NULL, *hid = NULL;
|
||||
char *config_file = PATH_NVMF_CONFIG;
|
||||
unsigned int verbose = 0;
|
||||
nvme_root_t r;
|
||||
@@ -746,11 +748,11 @@ int nvmf_connect(const char *desc, int argc, char **argv)
|
||||
nvme_read_config(r, config_file);
|
||||
|
||||
if (!hostnqn)
|
||||
- hostnqn = nvmf_hostnqn_from_file();
|
||||
+ hostnqn = hnqn = nvmf_hostnqn_from_file();
|
||||
if (!hostnqn)
|
||||
- hostnqn = nvmf_hostnqn_generate();
|
||||
+ hostnqn = hnqn = nvmf_hostnqn_generate();
|
||||
if (!hostid)
|
||||
- hostid = nvmf_hostid_from_file();
|
||||
+ hostid = hid = nvmf_hostid_from_file();
|
||||
h = nvme_lookup_host(r, hostnqn, hostid);
|
||||
if (!h) {
|
||||
errno = ENOMEM;
|
||||
@@ -781,8 +783,8 @@ int nvmf_connect(const char *desc, int argc, char **argv)
|
||||
}
|
||||
|
||||
out_free:
|
||||
- free(hostnqn);
|
||||
- free(hostid);
|
||||
+ free(hnqn);
|
||||
+ free(hid);
|
||||
if (dump_config)
|
||||
nvme_dump_config(r);
|
||||
nvme_free_tree(r);
|
@ -0,0 +1,89 @@
|
||||
commit 38f5a54a73069cb8a56564f0b80db99c48633723
|
||||
Author: Daniel Wagner <dwagner@suse.de>
|
||||
Date: Mon Apr 4 11:56:15 2022 +0200
|
||||
|
||||
fabrics: Support connect even when no /etc/nvme/hostnqn file exists
|
||||
|
||||
The connect call will fail if there is no /etc/nvme/hostnqn file
|
||||
available. The 1.x version did have a fallback mechanisme in place
|
||||
when the config file was missing.
|
||||
|
||||
Let's add this feature back by calling nvmf_hostnqn_generate() when
|
||||
there is no /etc/nvme/hostnqn file.
|
||||
|
||||
Signed-off-by: Daniel Wagner <dwagner@suse.de>
|
||||
|
||||
diff --git a/fabrics.c b/fabrics.c
|
||||
index ef80ec0d..30388f2d 100644
|
||||
--- a/fabrics.c
|
||||
+++ b/fabrics.c
|
||||
@@ -504,7 +504,6 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
char *subsysnqn = NVME_DISC_SUBSYS_NAME;
|
||||
char *hostnqn = NULL, *hostid = NULL, *hostkey = NULL, *ctrlkey = NULL;
|
||||
char *transport = NULL, *traddr = NULL, *trsvcid = NULL;
|
||||
- char *hnqn = NULL, *hid = NULL;
|
||||
char *config_file = PATH_NVMF_CONFIG;
|
||||
enum nvme_print_flags flags;
|
||||
nvme_root_t r;
|
||||
@@ -560,9 +559,11 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
set_discovery_kato(&cfg);
|
||||
|
||||
if (!hostnqn)
|
||||
- hostnqn = hnqn = nvmf_hostnqn_from_file();
|
||||
+ hostnqn = nvmf_hostnqn_from_file();
|
||||
+ if (!hostnqn)
|
||||
+ hostnqn = nvmf_hostnqn_generate();
|
||||
if (!hostid)
|
||||
- hostid = hid = nvmf_hostid_from_file();
|
||||
+ hostid = nvmf_hostid_from_file();
|
||||
h = nvme_lookup_host(r, hostnqn, hostid);
|
||||
if (!h) {
|
||||
ret = ENOMEM;
|
||||
@@ -657,10 +658,8 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
|
||||
out_free_ctrl:
|
||||
nvme_free_ctrl(c);
|
||||
out_free:
|
||||
- if (hnqn)
|
||||
- free(hnqn);
|
||||
- if (hid)
|
||||
- free(hid);
|
||||
+ free(hostnqn);
|
||||
+ free(hostid);
|
||||
if (dump_config)
|
||||
nvme_dump_config(r);
|
||||
nvme_free_tree(r);
|
||||
@@ -670,7 +669,6 @@ out_free:
|
||||
|
||||
int nvmf_connect(const char *desc, int argc, char **argv)
|
||||
{
|
||||
- char *hnqn = NULL, *hid = NULL;
|
||||
char *subsysnqn = NULL;
|
||||
char *transport = NULL, *traddr = NULL;
|
||||
char *trsvcid = NULL, *hostnqn = NULL, *hostid = NULL;
|
||||
@@ -748,9 +746,11 @@ int nvmf_connect(const char *desc, int argc, char **argv)
|
||||
nvme_read_config(r, config_file);
|
||||
|
||||
if (!hostnqn)
|
||||
- hostnqn = hnqn = nvmf_hostnqn_from_file();
|
||||
+ hostnqn = nvmf_hostnqn_from_file();
|
||||
+ if (!hostnqn)
|
||||
+ hostnqn = nvmf_hostnqn_generate();
|
||||
if (!hostid)
|
||||
- hostid = hid = nvmf_hostid_from_file();
|
||||
+ hostid = nvmf_hostid_from_file();
|
||||
h = nvme_lookup_host(r, hostnqn, hostid);
|
||||
if (!h) {
|
||||
errno = ENOMEM;
|
||||
@@ -781,10 +781,8 @@ int nvmf_connect(const char *desc, int argc, char **argv)
|
||||
}
|
||||
|
||||
out_free:
|
||||
- if (hnqn)
|
||||
- free(hnqn);
|
||||
- if (hid)
|
||||
- free(hid);
|
||||
+ free(hostnqn);
|
||||
+ free(hostid);
|
||||
if (dump_config)
|
||||
nvme_dump_config(r);
|
||||
nvme_free_tree(r);
|
@ -1,5 +1,5 @@
|
||||
Name: nvme-cli
|
||||
Version: 2.0~rc6
|
||||
Version: 2.0~rc8
|
||||
Release: 1%{?dist}
|
||||
Summary: NVMe management command line interface
|
||||
|
||||
@ -8,7 +8,8 @@ URL: https://github.com/linux-nvme/nvme-cli
|
||||
Source0: %{url}/archive/v%{version_no_tilde}/%{name}-%{version_no_tilde}.tar.gz
|
||||
|
||||
# backport from upstream
|
||||
Patch0: connect_return_code.patch
|
||||
Patch0: nvme-cli-2.0-rc9_fabrics_Support_connect_even_when_no_hostnqn_file_exists.patch
|
||||
Patch1: nvme-cli-2.0-rc9_fabrics_Do_not_free_static_string.patch
|
||||
|
||||
BuildRequires: meson >= 0.47.0
|
||||
BuildRequires: libuuid-devel
|
||||
@ -17,7 +18,7 @@ BuildRequires: systemd-devel
|
||||
BuildRequires: zlib-devel
|
||||
BuildRequires: openssl-devel
|
||||
|
||||
BuildRequires: libnvme-devel >= 1.0~rc4
|
||||
BuildRequires: libnvme-devel >= 1.0~rc8
|
||||
BuildRequires: json-c-devel >= 0.14
|
||||
BuildRequires: python3-nose2
|
||||
BuildRequires: python3-mypy
|
||||
@ -76,7 +77,22 @@ rm -rf %{buildroot}%{_pkgdocdir}/nvme
|
||||
# /usr/lib/dracut/dracut.conf.d/70-nvmf-autoconnect.conf
|
||||
|
||||
|
||||
%post
|
||||
if [ $1 -eq 1 ] || [ $1 -eq 2 ]; then
|
||||
if [ ! -s %{_sysconfdir}/nvme/hostnqn ]; then
|
||||
echo $(nvme gen-hostnqn) > %{_sysconfdir}/nvme/hostnqn
|
||||
fi
|
||||
if [ ! -s %{_sysconfdir}/nvme/hostid ]; then
|
||||
uuidgen > %{_sysconfdir}/nvme/hostid
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Apr 04 2022 Tomas Bzatek <tbzatek@redhat.com> - 2.0~rc8-1
|
||||
- Update to 2.0-rc8
|
||||
- Added scriptlet to generate /etc/nvme/hostnqn and hostid files (#2065886)
|
||||
|
||||
* Tue Mar 15 2022 Tomas Bzatek <tbzatek@redhat.com> - 2.0~rc6-1
|
||||
- Update to 2.0-rc6
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (nvme-cli-2.0-rc6.tar.gz) = 00e0376f0a5b69c2a9192c8261da73492aeb6bfe19cd488382e18b50e247a4591b470349f42503bab5d4881c35a056a033213624503efa62de9f8e98dfe4b005
|
||||
SHA512 (nvme-cli-2.0-rc8.tar.gz) = ebb4dcca3c23d0f1e586a55a0ce9e0b885f96cefce64521aaeb5419ffcd67595b146496865fe09b2f69870ee7dc4583430178ac71f724278b233cc970d217163
|
||||
|
Loading…
Reference in New Issue
Block a user