Skip to content

Commit 5ad0aaa

Browse files
Martin Belangerigaw
authored andcommitted
nvme-cli/fabrics: note an excluded target on connect under --verbose
The exclusion list governs auto-connecting orchestrators, not an explicit "nvme connect", so connect must never be blocked by it. But an operator who hand-connects a controller they previously excluded is overriding their own opt-out, often unknowingly. Under --verbose, consult the list and print a note when the target matches, making the override visible without changing behaviour. Document the courtesy in EXCLUSIONS.md. Signed-off-by: Martin Belanger <martin.belanger@dell.com>
1 parent ee960c2 commit 5ad0aaa

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

fabrics.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,26 @@ int fabrics_connect(const char *desc, int argc, char **argv)
770770
if (config_file)
771771
return libnvmf_connect_config_json(ctx, fctx);
772772

773+
/*
774+
* The exclusion list governs auto-connecting orchestrators, not an
775+
* explicit "nvme connect", so we never block it here. But under
776+
* --verbose, note when the target matches an exclusion entry so the
777+
* operator knows they are overriding their own opt-out.
778+
*/
779+
if (nvme_args.verbose) {
780+
struct libnvmf_tid *tid;
781+
782+
tid = libnvmf_tid_from_fields(fa.transport, fa.traddr,
783+
fa.trsvcid, fa.subsysnqn,
784+
fa.host_traddr, fa.host_iface,
785+
fa.hostnqn, fa.hostid);
786+
if (tid && libnvmf_exclusion_match(ctx, tid))
787+
fprintf(stderr,
788+
"Note: %s is on the exclusion list; connecting anyway\n",
789+
fa.subsysnqn ? fa.subsysnqn : "this controller");
790+
libnvmf_tid_free(tid);
791+
}
792+
773793
ret = libnvmf_connect(ctx, fctx);
774794
if (ret) {
775795
fprintf(stderr, "failed to connect: %s\n",

libnvme/design/EXCLUSIONS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ if (libnvmf_exclusion_match(ctx, tid))
9494
continue; /* administrator excluded this controller */
9595
```
9696

97-
`libnvmf_exclusion_match()` re-reads the directory on every call (no caching), so an edit takes effect on the next connection attempt without restarting anything. This is the only API an orchestrator needs; the create/add/remove calls are for the management tooling.
97+
`libnvmf_exclusion_match()` re-reads the files on every call (no caching), so an edit takes effect on the next connection attempt without restarting anything. This is the only API an orchestrator needs; the create/add/remove calls are for the management tooling.
9898

99-
The match is by design *not* applied to `nvme connect <args>` or `nvme disconnect <device>`: those are single, targeted human actions where the operator's intent is explicit. The list governs the *orchestrating* paths that decide on their own.
99+
The match is by design *not* allowed to **block** `nvme connect <args>` or `nvme disconnect <device>`: those are single, targeted human actions where the operator's intent is explicit. The list governs the *orchestrating* paths that decide on their own. As a courtesy, `nvme connect --verbose` does *consult* the list and prints a note when the target matches — a heads-up that you are overriding your own opt-out — but it still connects.
100100

101101
## Managing the list
102102

0 commit comments

Comments
 (0)