Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH rfc 1/6] nvme-cli: ignore arguments that pass in "none"
Date: Wed, 10 Jul 2019 16:27:35 -0700	[thread overview]
Message-ID: <20190710232740.26734-2-jsmart2021@gmail.com> (raw)
In-Reply-To: <20190710232740.26734-1-jsmart2021@gmail.com>

As we want to support discovery uevents over different
transports, we want to allow the kernel to provide missing
information in the form of none and have nvme-cli properly
ignore it.

One example is the host_traddr. If it is not set (which means
that the default route determined the host address) we will
want to do the same for newly discovered controllers.

So allow users to pass 'none' arguments as well.

Example:
  nvme connect-all ... --hostnqn=none --hostid=none --host_traddr=none

Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
Signed-off-by: James Smart <jsmart2021 at gmail.com>
Reviewed-by: Hannes Reinecke <hare at suse.com>

---
Patch originated from Sagi in an RFC
Fixed typo in Sagi's patch on cfg.hostid
---
 fabrics.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fabrics.c b/fabrics.c
index 573a6ef..cc91d00 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -565,7 +565,7 @@ add_argument(char **argstr, int *max_len, char *arg_str, char *arg)
 {
 	int len;
 
-	if (arg) {
+	if (arg && strcmp(arg, "none")) {
 		len = snprintf(*argstr, *max_len, ",%s=%s", arg_str, arg);
 		if (len < 0)
 			return -EINVAL;
@@ -658,14 +658,14 @@ retry:
 		return -EINVAL;
 	p += len;
 
-	if (cfg.hostnqn) {
+	if (cfg.hostnqn && strcmp(cfg.hostnqn, "none")) {
 		len = sprintf(p, ",hostnqn=%s", cfg.hostnqn);
 		if (len < 0)
 			return -EINVAL;
 		p += len;
 	}
 
-	if (cfg.hostid) {
+	if (cfg.hostid && strcmp(cfg.hostid, "none")) {
 		len = sprintf(p, ",hostid=%s", cfg.hostid);
 		if (len < 0)
 			return -EINVAL;
@@ -700,7 +700,7 @@ retry:
 		p += len;
 	}
 
-	if (cfg.host_traddr) {
+	if (cfg.host_traddr && strcmp(cfg.host_traddr, "none")) {
 		len = sprintf(p, ",host_traddr=%s", cfg.host_traddr);
 		if (len < 0)
 			return -EINVAL;
-- 
2.13.7

  reply	other threads:[~2019-07-10 23:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 23:27 [PATCH rfc 0/6] nvme-cli: nvmf auto-connect scripts James Smart
2019-07-10 23:27 ` James Smart [this message]
2019-07-11 12:28   ` [PATCH rfc 1/6] nvme-cli: ignore arguments that pass in "none" Minwoo Im
2019-07-10 23:27 ` [PATCH rfc 2/6] nvme-cli: support persistent connections to a discovery controller James Smart
2019-07-11 12:33   ` Minwoo Im
2019-07-10 23:27 ` [PATCH rfc 3/6] nvme-cli: allow discover to address discovery controller by persistent name James Smart
2019-07-11 12:41   ` Minwoo Im
2019-07-11 16:16     ` James Smart
2019-07-11 17:11       ` Minwoo Im
2019-07-10 23:27 ` [PATCH rfc 4/6] nvme-cli: expand --device argument processing James Smart
2019-07-11  0:43   ` Sagi Grimberg
2019-07-11 23:54   ` Sagi Grimberg
2019-07-10 23:27 ` [PATCH rfc 5/6] nvme-cli: add --quiet option James Smart
2019-07-11 12:53   ` Minwoo Im
2019-07-10 23:27 ` [PATCH rfc 6/6] nvme-cli: nvmf auto-connect scripts James Smart
2019-07-11  0:42   ` Sagi Grimberg
2019-07-11 16:18     ` James Smart
2019-07-11 23:47       ` Sagi Grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190710232740.26734-2-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox