nvmf: simplify err output in case transport is not found

We were using the stringified trtype which will always just print "CUSTOM" for pluggable transport
types. It is better to use the trstring since it will exactly print the transport name as requested.

Signed-off-by: Jacek Kalwas <jacek.kalwas@intel.com>
Change-Id: I5c184fe0ec209366339b658c647629d76bb8300b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5643
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jacek Kalwas 2020-12-18 12:40:24 -05:00 committed by Tomasz Zawadzki
parent 400c3b8a52
commit de8ac98b83
3 changed files with 9 additions and 20 deletions

View File

@ -603,19 +603,12 @@ spdk_nvmf_tgt_listen(struct spdk_nvmf_tgt *tgt,
struct spdk_nvme_transport_id *trid)
{
struct spdk_nvmf_transport *transport;
const char *trtype;
int rc;
transport = spdk_nvmf_tgt_get_transport(tgt, trid->trstring);
if (!transport) {
trtype = spdk_nvme_transport_id_trtype_str(trid->trtype);
if (trtype != NULL) {
SPDK_ERRLOG("Unable to listen on transport %s. The transport must be created first.\n", trtype);
} else {
SPDK_ERRLOG("The specified trtype %d is unknown. Please make sure that it is properly registered.\n",
trid->trtype);
}
SPDK_ERRLOG("Unable to find %s transport. The transport must be created first also make sure it is properly registered.\n",
trid->trstring);
return -EINVAL;
}
@ -632,19 +625,12 @@ spdk_nvmf_tgt_stop_listen(struct spdk_nvmf_tgt *tgt,
struct spdk_nvme_transport_id *trid)
{
struct spdk_nvmf_transport *transport;
const char *trtype;
int rc;
transport = spdk_nvmf_tgt_get_transport(tgt, trid->trstring);
if (!transport) {
trtype = spdk_nvme_transport_id_trtype_str(trid->trtype);
if (trtype != NULL) {
SPDK_ERRLOG("Unable to stop listen on transport %s. The transport must be created first.\n",
trtype);
} else {
SPDK_ERRLOG("The specified trtype %d is unknown. Please make sure that it is properly registered.\n",
trid->trtype);
}
SPDK_ERRLOG("Unable to find %s transport. The transport must be created first also make sure it is properly registered.\n",
trid->trstring);
return -EINVAL;
}

View File

@ -1007,6 +1007,8 @@ rpc_nvmf_subsystem_remove_listener(struct spdk_jsonrpc_request *request,
ctx->transport = spdk_nvmf_tgt_get_transport(tgt, ctx->trid.trstring);
if (!ctx->transport) {
SPDK_ERRLOG("Unable to find %s transport. The transport must be created first also make sure it is properly registered.\n",
ctx->trid.trstring);
spdk_jsonrpc_send_error_response(ctx->request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
"Invalid parameters");
nvmf_rpc_listener_ctx_free(ctx);

View File

@ -972,8 +972,9 @@ spdk_nvmf_subsystem_add_listener(struct spdk_nvmf_subsystem *subsystem,
}
transport = spdk_nvmf_tgt_get_transport(subsystem->tgt, trid->trstring);
if (transport == NULL) {
SPDK_ERRLOG("Unknown transport type %d\n", trid->trtype);
if (!transport) {
SPDK_ERRLOG("Unable to find %s transport. The transport must be created first also make sure it is properly registered.\n",
trid->trstring);
cb_fn(cb_arg, -EINVAL);
return;
}