* [PATCH] Adding hostnqn parameter to connect and discover commands
@ 2016-07-28 21:04 Roy Shterman
2016-07-28 21:04 ` [PATCH] nvme-cli/fabrics: Adding hostnqn parameter to discover and connect Roy Shterman
0 siblings, 1 reply; 2+ messages in thread
From: Roy Shterman @ 2016-07-28 21:04 UTC (permalink / raw)
'hostnqn' is a valid parameter which can be used
when executing connect or discover commands from initiator side but
doesn't have support in nvme-cli tool.
Roy Shterman (1):
nvme-cli/fabrics: Adding missing parameters to discover and connect
fabrics.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
--
1.7.8.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] nvme-cli/fabrics: Adding hostnqn parameter to discover and connect
2016-07-28 21:04 [PATCH] Adding hostnqn parameter to connect and discover commands Roy Shterman
@ 2016-07-28 21:04 ` Roy Shterman
0 siblings, 0 replies; 2+ messages in thread
From: Roy Shterman @ 2016-07-28 21:04 UTC (permalink / raw)
Adding user-defined 'hostnqn' to 'discover' and 'connect' commands
so users could use the allowed_hosts attribute on the target and still
using nvme-cli tool.
usage examples:
nvme discover -t <TRANSPORT> -a <ADDRESS> -s <SERVICE_ID> -q <USER-DEFINED_HOSTNQN>
Signed-off-by: Roy Shterman <roysh at mellanox.com>
---
fabrics.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/fabrics.c b/fabrics.c
index 3666a01..7ecdf90 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -49,6 +49,7 @@ struct config {
char *transport;
char *traddr;
char *trsvcid;
+ char *hostnqn;
char *raw;
char *device;
} cfg = { 0 };
@@ -395,6 +396,14 @@ static int build_options(char *argstr, int max_len)
max_len -= len;
}
+ if (cfg.hostnqn) {
+ len = snprintf(argstr, max_len, ",hostnqn=%s", cfg.hostnqn);
+ if (len < 0)
+ return -EINVAL;
+ argstr +=len;
+ max_len -= len;
+ }
+
return 0;
}
@@ -527,6 +536,8 @@ int discover(const char *desc, int argc, char **argv, bool connect)
"transport service id (e.g. IP port)" },
{"raw", 'r', "LIST", CFG_STRING, &cfg.raw, required_argument,
"raw output file" },
+ {"hostnqn", 'q', "LIST", CFG_STRING, &cfg.hostnqn, required_argument,
+ "user-defined hostnqn" },
{0},
};
@@ -554,6 +565,8 @@ int connect(const char *desc, int argc, char **argv)
"transport address" },
{"trsvcid", 's', "LIST", CFG_STRING, &cfg.trsvcid, required_argument,
"transport service id (e.g. IP port)" },
+ {"hostnqn", 'q', "LIST", CFG_STRING, &cfg.hostnqn, required_argument,
+ "user-defined hostnqn" },
{0},
};
--
1.7.8.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-28 21:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-28 21:04 [PATCH] Adding hostnqn parameter to connect and discover commands Roy Shterman
2016-07-28 21:04 ` [PATCH] nvme-cli/fabrics: Adding hostnqn parameter to discover and connect Roy Shterman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).