Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
nvme-cli
0017-connect-all-add-m-matching-option.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0017-connect-all-add-m-matching-option.patch of Package nvme-cli
From: Martin Wilck <mwilck@suse.com> Date: Wed, 29 Apr 2020 19:03:57 +0200 Subject: connect-all: add -m/--matching option References: bsc#1186719 Git-commit: a58556cc3022ec443f0db4a5218d8e2bfb3be481 Discovery controllers often return discovery records that belong to a different traddr than the discovery controller itself, like here: nvme discover -t fc \ --host-traddr=nn-0x20000090fae06325:pn-0x10000090fae06325 \ --traddr=nn-0x200900a09890f5bf:pn-0x200a00a09890f5bf Discovery Log Number of Records 2, Generation counter 25 =====Discovery Log Entry 0====== trtype: fc adrfam: fibre-channel subtype: nvme subsystem treq: not specified portid: 0 trsvcid: none subnqn: nqn... traddr: nn-0x200900a09890f5bf:pn-0x200b00a09890f5bf =====Discovery Log Entry 1====== trtype: fc adrfam: fibre-channel subtype: nvme subsystem treq: not specified portid: 1 trsvcid: none subnqn: nqn... traddr: nn-0x200900a09890f5bf:pn-0x200a00a09890f5bf Note that the traddr of record 0 matches the traddr used for the discovery, while that of record 1 does not. For NVMeoF-autoconnect, this means that connection attempts will be made multiple times (the two records above will also be returned for a discovery on nn-0x200900a09890f5bf:pn-0x200b00a09890f5bf), which is unnecessary and leads to lots of confusing error messages in the system log. Add an option "-m / --matching" to the "nvme connect-all" command that causes nvme to connect only those discovery entries that match the traddr given on the command line. --- fabrics.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) --- a/fabrics.c +++ b/fabrics.c @@ -80,6 +80,7 @@ static struct config { int data_digest; bool persistent; bool quiet; + bool matching_only; } cfg = { NULL }; struct connect_args { @@ -1117,6 +1118,17 @@ static int connect_ctrl(struct nvmf_disc return ret; } +static bool should_connect(struct nvmf_disc_rsp_page_entry *entry) +{ + int len; + + if (!cfg.matching_only || !cfg.traddr) + return true; + + len = space_strip_len(NVMF_TRADDR_SIZE, entry->traddr); + return !strncmp(cfg.traddr, entry->traddr, len); +} + static int connect_ctrls(struct nvmf_disc_rsp_page_hdr *log, int numrec) { int i; @@ -1124,6 +1136,9 @@ static int connect_ctrls(struct nvmf_dis int ret = 0; for (i = 0; i < numrec; i++) { + if (!should_connect(&log->entries[i])) + continue; + instance = connect_ctrl(&log->entries[i]); /* clean success */ @@ -1322,6 +1337,7 @@ int discover(const char *desc, int argc, OPT_INT("queue-size", 'Q', &cfg.queue_size, "number of io queue elements to use (default 128)"), OPT_FLAG("persistent", 'p', &cfg.persistent, "persistent discovery connection"), OPT_FLAG("quiet", 'S', &cfg.quiet, "suppress already connected errors"), + OPT_FLAG("matching", 'm', &cfg.matching_only, "connect only records matching the traddr"), OPT_END() };
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor