* Mon Apr 11 2022 Tomas Bzatek <tbzatek@redhat.com> - 2.0-1

- Update to 2.0
This commit is contained in:
Tomas Bzatek 2022-04-11 14:22:07 +02:00
parent 726694821c
commit ea4b1fb223
5 changed files with 7 additions and 180 deletions

1
.gitignore vendored
View File

@ -21,3 +21,4 @@
/nvme-cli-2.0-rc5.tar.gz /nvme-cli-2.0-rc5.tar.gz
/nvme-cli-2.0-rc6.tar.gz /nvme-cli-2.0-rc6.tar.gz
/nvme-cli-2.0-rc8.tar.gz /nvme-cli-2.0-rc8.tar.gz
/nvme-cli-2.0.tar.gz

View File

@ -1,84 +0,0 @@
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);

View File

@ -1,89 +0,0 @@
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);

View File

@ -1,5 +1,5 @@
Name: nvme-cli Name: nvme-cli
Version: 2.0~rc8 Version: 2.0
Release: 1%{?dist} Release: 1%{?dist}
Summary: NVMe management command line interface Summary: NVMe management command line interface
@ -7,10 +7,6 @@ License: GPLv2+
URL: https://github.com/linux-nvme/nvme-cli URL: https://github.com/linux-nvme/nvme-cli
Source0: %{url}/archive/v%{version_no_tilde}/%{name}-%{version_no_tilde}.tar.gz Source0: %{url}/archive/v%{version_no_tilde}/%{name}-%{version_no_tilde}.tar.gz
# backport from upstream
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: meson >= 0.47.0
BuildRequires: libuuid-devel BuildRequires: libuuid-devel
BuildRequires: gcc gcc-c++ BuildRequires: gcc gcc-c++
@ -18,7 +14,7 @@ BuildRequires: systemd-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
BuildRequires: openssl-devel BuildRequires: openssl-devel
BuildRequires: libnvme-devel >= 1.0~rc8 BuildRequires: libnvme-devel >= 1.0
BuildRequires: json-c-devel >= 0.14 BuildRequires: json-c-devel >= 0.14
BuildRequires: python3-nose2 BuildRequires: python3-nose2
BuildRequires: python3-mypy BuildRequires: python3-mypy
@ -89,6 +85,9 @@ fi
%changelog %changelog
* Mon Apr 11 2022 Tomas Bzatek <tbzatek@redhat.com> - 2.0-1
- Update to 2.0
* Mon Apr 04 2022 Tomas Bzatek <tbzatek@redhat.com> - 2.0~rc8-1 * Mon Apr 04 2022 Tomas Bzatek <tbzatek@redhat.com> - 2.0~rc8-1
- Update to 2.0-rc8 - Update to 2.0-rc8
- Added scriptlet to generate /etc/nvme/hostnqn and hostid files (#2065886) - Added scriptlet to generate /etc/nvme/hostnqn and hostid files (#2065886)

View File

@ -1 +1 @@
SHA512 (nvme-cli-2.0-rc8.tar.gz) = ebb4dcca3c23d0f1e586a55a0ce9e0b885f96cefce64521aaeb5419ffcd67595b146496865fe09b2f69870ee7dc4583430178ac71f724278b233cc970d217163 SHA512 (nvme-cli-2.0.tar.gz) = 24a00ee8e0fc963c1757797413ff5725cec18f821a714d6bbbf37906010d72934d6fdd7b466c085f13716a5279d1a7bd3254ee474e37a0ecd00a85ef23e12417