bdev/nvme: save the trid of the discovery service

This is useful for adding trid details to discovery
related log messages in a later patch.

Future patches will update this trid if the
current discovery ctrlr fails and we need to fail
over to a different path to the discovery subsystem.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I51712bab2d891ae9c683f8716b4228741f64e7db
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11732
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Jim Harris 2022-02-24 14:52:47 +00:00 committed by Tomasz Zawadzki
parent a0690464dd
commit 9614dca9f9

View File

@ -4138,6 +4138,7 @@ struct discovery_ctx {
struct spdk_nvme_probe_ctx *probe_ctx;
struct spdk_nvme_detach_ctx *detach_ctx;
struct spdk_nvme_ctrlr *ctrlr;
struct spdk_nvme_transport_id trid;
struct spdk_poller *poller;
struct spdk_nvme_ctrlr_opts opts;
TAILQ_ENTRY(discovery_ctx) tailq;
@ -4494,13 +4495,14 @@ bdev_nvme_start_discovery(struct spdk_nvme_transport_id *trid,
TAILQ_INIT(&ctx->nvm_entry_ctxs);
TAILQ_INIT(&ctx->discovery_entry_ctxs);
snprintf(trid->subnqn, sizeof(trid->subnqn), "%s", SPDK_NVMF_DISCOVERY_NQN);
memcpy(&ctx->trid, trid, sizeof(*trid));
/* Even if user did not specify hostnqn, we can still strdup("\0"); */
ctx->hostnqn = strdup(ctx->opts.hostnqn);
if (ctx->hostnqn == NULL) {
free_discovery_ctx(ctx);
return -ENOMEM;
}
ctx->probe_ctx = spdk_nvme_connect_async(trid, &ctx->opts, discovery_attach_cb);
ctx->probe_ctx = spdk_nvme_connect_async(&ctx->trid, &ctx->opts, discovery_attach_cb);
if (ctx->probe_ctx == NULL) {
SPDK_ERRLOG("could not start discovery connect\n");
free_discovery_ctx(ctx);