File 0006-fabrics-Remove-dhchap-ctrl-secret-from-discover-conn.patch of Package nvme-cli.26914

From: Daniel Wagner <dwagner@suse.de>
Date: Mon, 1 Aug 2022 13:52:31 +0200
Subject: fabrics: Remove dhchap-ctrl-secret from discover/connect-all
Git-commit: ebf25c39950494dd57aee59640ee524fc1c03110
References: bsc#1201701

The dhchap-ctrl-secret is per controller but discover and connect-all
operate on several controllers.

As this get's very fast complicated how to express this on the command
line, just drop the it. It was not implemented anyway and not listed
in the documentation.

Use the JSON config file in this case.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 fabrics.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/fabrics.c
+++ b/fabrics.c
@@ -89,7 +89,6 @@ static const char *nvmf_config_file	= "U
 	OPT_STRING("hostid",          'I', "STR", &hostid,	nvmf_hostid), \
 	OPT_STRING("nqn",             'n', "STR", &subsysnqn,	nvmf_nqn), \
 	OPT_STRING("dhchap-secret",   'S', "STR", &hostkey,     nvmf_hostkey), \
-	OPT_STRING("dhchap-ctrl-secret", 'C', "STR", &ctrlkey,  nvmf_ctrlkey), \
 	OPT_INT("nr-io-queues",       'i', &c.nr_io_queues,       nvmf_nr_io_queues),	\
 	OPT_INT("nr-write-queues",    'W', &c.nr_write_queues,    nvmf_nr_write_queues),\
 	OPT_INT("nr-poll-queues",     'P', &c.nr_poll_queues,     nvmf_nr_poll_queues),	\
@@ -500,7 +499,7 @@ static int discover_from_conf_file(nvme_
 				   const struct nvme_fabrics_config *defcfg)
 {
 	char *transport = NULL, *traddr = NULL, *trsvcid = NULL;
-	char *hostnqn = NULL, *hostid = NULL, *hostkey = NULL, *ctrlkey = NULL;
+	char *hostnqn = NULL, *hostid = NULL, *hostkey = NULL;
 	char *subsysnqn = NULL;
 	char *ptr, **argv, *p, line[4096];
 	int argc, ret = 0;
@@ -604,7 +603,7 @@ static int discover_from_conf_file(nvme_
 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 *hostnqn = NULL, *hostid = NULL, *hostkey = NULL;
 	char *transport = NULL, *traddr = NULL, *trsvcid = NULL;
 	char *config_file = PATH_NVMF_CONFIG;
 	char *hnqn = NULL, *hid = NULL;
@@ -789,6 +788,7 @@ int nvmf_connect(const char *desc, int a
 
 	OPT_ARGS(opts) = {
 		NVMF_OPTS(cfg),
+		OPT_STRING("dhchap-ctrl-secret", 'C', "STR", &ctrlkey,  nvmf_ctrlkey),
 		OPT_STRING("config", 'J', "FILE", &config_file, nvmf_config_file),
 		OPT_INCR("verbose", 'v', &verbose, "Increase logging verbosity"),
 		OPT_FLAG("dump-config", 'O', &dump_config, "Dump JSON configuration to stdout"),
@@ -1070,6 +1070,7 @@ int nvmf_config(const char *desc, int ar
 
 	OPT_ARGS(opts) = {
 		NVMF_OPTS(cfg),
+		OPT_STRING("dhchap-ctrl-secret", 'C', "STR", &ctrlkey,  nvmf_ctrlkey),
 		OPT_STRING("config", 'J', "FILE", &config_file, nvmf_config_file),
 		OPT_INCR("verbose", 'v', &verbose, "Increase logging verbosity"),
 		OPT_FLAG("scan", 'R', &scan_tree, "Scan current NVMeoF topology"),
openSUSE Build Service is sponsored by