Commit 0891f506 authored by Lance Hartmann's avatar Lance Hartmann Committed by Ben Walker
Browse files

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: default avatarLance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/435192


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 1906a14e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -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);
		}