nvme: Silently ignore ns key in transport id string

spdk_nvme_transport_id_parse() does not recognize the
namespace id, "ns", key as part of the transport id string
and thus logs an error message, but does not fail the call.
However, some SPDK applications, e.g. nvme/perf, in addition
to using spdk_nvme_transport_id_parse() also check for the
existence of a "ns" key in the transport id string to limit
the target to a specific namespace.  This commit adds a
special case to spdk_nvme_transport_id_parse() to silently
ignore the presence of a "ns" key without logging it as an
error.

Change-Id: I49732b4d1b0227a38bb308eab1f6324dd241a2de
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/435192
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Lance Hartmann 2018-11-27 14:00:17 -05:00 committed by Ben Walker
parent 1906a14e1f
commit 0891f506fc

View File

@ -811,6 +811,18 @@ spdk_nvme_transport_id_parse(struct spdk_nvme_transport_id *trid, const char *st
return -EINVAL;
}
memcpy(trid->subnqn, val, val_len + 1);
} else if (strcasecmp(key, "ns") == 0) {
/*
* Special case. The namespace id parameter may
* optionally be passed in the transport id string
* for an SPDK application (e.g. nvme/perf)
* and additionally parsed therein to limit
* targeting a specific namespace. For this
* scenario, just silently ignore this key
* rather than letting it default to logging
* it as an invalid key.
*/
continue;
} else {
SPDK_ERRLOG("Unknown transport ID key '%s'\n", key);
}