Skip to content

Commit

Permalink
nvmf: use "nqn" rather than "subnqn" in RPC param
Browse files Browse the repository at this point in the history
This fixes the new nvmf_subsystem_add_listener RPC method to use "nqn"
as the parameter name to be consistent with the other NVMe-oF target RPC
methods.

Since this method is brand new, no provision for compatibility with the
old name is provided.

Fixes: 6336217 ("nvmf: Add rpc to add listeners to subsystems")
Change-Id: I86263fb1c53ed6ab48fe70917686d78a4a7ce28d
Signed-off-by: Daniel Verkamp <[email protected]>
Reviewed-on: https://review.gerrithub.io/398870
Tested-by: SPDK Automated Test System <[email protected]>
Reviewed-by: Jim Harris <[email protected]>
Reviewed-by: Changpeng Liu <[email protected]>
  • Loading branch information
danielverkamp authored and jimharris committed Feb 8, 2018
1 parent 9ee661b commit 9f59705
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions app/nvmf_tgt/nvmf_rpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ spdk_rpc_delete_nvmf_subsystem(struct spdk_jsonrpc_request *request,
SPDK_RPC_REGISTER("delete_nvmf_subsystem", spdk_rpc_delete_nvmf_subsystem)

struct nvmf_rpc_listener_ctx {
char *subnqn;
char *nqn;
struct rpc_listen_address address;

struct spdk_jsonrpc_request *request;
Expand All @@ -551,14 +551,14 @@ struct nvmf_rpc_listener_ctx {
};

static const struct spdk_json_object_decoder nvmf_rpc_listener_decoder[] = {
{"subnqn", offsetof(struct nvmf_rpc_listener_ctx, subnqn), spdk_json_decode_string},
{"nqn", offsetof(struct nvmf_rpc_listener_ctx, nqn), spdk_json_decode_string},
{"listen_address", offsetof(struct nvmf_rpc_listener_ctx, address), decode_rpc_listen_address},
};

static void
nvmf_rpc_listener_ctx_free(struct nvmf_rpc_listener_ctx *ctx)
{
free(ctx->subnqn);
free(ctx->nqn);
free_rpc_listen_address(&ctx->address);
free(ctx);
}
Expand Down Expand Up @@ -646,9 +646,9 @@ nvmf_rpc_subsystem_add_listener(struct spdk_jsonrpc_request *request,
return;
}

subsystem = spdk_nvmf_tgt_find_subsystem(g_tgt.tgt, ctx->subnqn);
subsystem = spdk_nvmf_tgt_find_subsystem(g_tgt.tgt, ctx->nqn);
if (!subsystem) {
SPDK_ERRLOG("Unable to find subsystem with NQN %s\n", ctx->subnqn);
SPDK_ERRLOG("Unable to find subsystem with NQN %s\n", ctx->nqn);
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, "Invalid parameters");
nvmf_rpc_listener_ctx_free(ctx);
return;
Expand Down
4 changes: 2 additions & 2 deletions doc/jsonrpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ Add a new listen address to an NVMe-oF subsystem.

Name | Optional | Type | Description
----------------------- | -------- | ----------- | -----------
subnqn | Required | string | Subsystem NQN
nqn | Required | string | Subsystem NQN
listen_address | Required | object | @ref rpc_construct_nvmf_subsystem_listen_address object

### Example
Expand All @@ -364,7 +364,7 @@ Example request:
"id": 1,
"method": "nvmf_subsystem_add_listener",
"params": {
"subnqn": "nqn.2016-06.io.spdk:cnode1",
"nqn": "nqn.2016-06.io.spdk:cnode1",
"listen_address": {
"trtype": "RDMA",
"adrfam": "IPv4",
Expand Down
2 changes: 1 addition & 1 deletion scripts/rpc/nvmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def nvmf_subsystem_add_listener(args):
if args.adrfam:
listen_address['adrfam'] = args.adrfam

params = {'subnqn': args.nqn,
params = {'nqn': args.nqn,
'listen_address': listen_address}

args.client.call('nvmf_subsystem_add_listener', params)
Expand Down

0 comments on commit 9f59705

Please sign in to comment.