Commit 6ee44c69 authored by Jim Harris's avatar Jim Harris Committed by Darek Stojaczyk
Browse files

rpc: rename RPC get_rpc_methods to rpc_get_methods



Make the old name a deprecated alias.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ibbf50676e0d989b67121e465fc140f94faec46ed

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453033


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 683099e3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ will enter the `RUNTIME` state and the list of available commands becomes much
larger.

To see which RPC methods are available in the current state, issue the
`get_rpc_methods` with the parameter `current` set to `true`.
`rpc_get_methods` with the parameter `current` set to `true`.

For more details see @ref jsonrpc documentation.

+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ chapters is done by using JSON-RPC commands. SPDK provides a python-based
command line tool for sending RPC commands located at `scripts/rpc.py`. User
can list available commands by running this script with `-h` or `--help` flag.
Additionally user can retrieve currently supported set of RPC commands
directly from SPDK application by running `scripts/rpc.py get_rpc_methods`.
directly from SPDK application by running `scripts/rpc.py rpc_get_methods`.
Detailed help for each command can be displayed by adding `-h` flag as a
command parameter.

+2 −2
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ Example response:
}
~~~

## get_rpc_methods {#rpc_get_rpc_methods}
## rpc_get_methods {#rpc_rpc_get_methods}

Get an array of supported RPC methods.

@@ -227,7 +227,7 @@ Example request:
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "get_rpc_methods"
  "method": "rpc_get_methods"
}
~~~

+9 −9
Original line number Diff line number Diff line
@@ -340,25 +340,24 @@ spdk_rpc_close(void)
	}
}

struct rpc_get_rpc_methods {
struct rpc_get_methods {
	bool current;
};

static const struct spdk_json_object_decoder rpc_get_rpc_methods_decoders[] = {
	{"current", offsetof(struct rpc_get_rpc_methods, current), spdk_json_decode_bool, true},
static const struct spdk_json_object_decoder rpc_get_methods_decoders[] = {
	{"current", offsetof(struct rpc_get_methods, current), spdk_json_decode_bool, true},
};

static void
spdk_rpc_get_rpc_methods(struct spdk_jsonrpc_request *request,
			 const struct spdk_json_val *params)
spdk_rpc_get_methods(struct spdk_jsonrpc_request *request, const struct spdk_json_val *params)
{
	struct rpc_get_rpc_methods req = {};
	struct rpc_get_methods req = {};
	struct spdk_json_write_ctx *w;
	struct spdk_rpc_method *m;

	if (params != NULL) {
		if (spdk_json_decode_object(params, rpc_get_rpc_methods_decoders,
					    SPDK_COUNTOF(rpc_get_rpc_methods_decoders), &req)) {
		if (spdk_json_decode_object(params, rpc_get_methods_decoders,
					    SPDK_COUNTOF(rpc_get_methods_decoders), &req)) {
			SPDK_ERRLOG("spdk_json_decode_object failed\n");
			spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
							 "Invalid parameters");
@@ -381,7 +380,8 @@ spdk_rpc_get_rpc_methods(struct spdk_jsonrpc_request *request,
	spdk_json_write_array_end(w);
	spdk_jsonrpc_end_result(request, w);
}
SPDK_RPC_REGISTER("get_rpc_methods", spdk_rpc_get_rpc_methods, SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER("rpc_get_methods", spdk_rpc_get_methods, SPDK_RPC_STARTUP | SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(rpc_get_methods, get_rpc_methods)

static void
spdk_rpc_get_spdk_version(struct spdk_jsonrpc_request *request, const struct spdk_json_val *params)
+4 −4
Original line number Diff line number Diff line
@@ -48,13 +48,13 @@ if __name__ == "__main__":
    p = subparsers.add_parser('wait_subsystem_init', help='Block until subsystems have been initialized')
    p.set_defaults(func=wait_subsystem_init)

    def get_rpc_methods(args):
        print_dict(rpc.get_rpc_methods(args.client,
    def rpc_get_methods(args):
        print_dict(rpc.rpc_get_methods(args.client,
                                       current=args.current))

    p = subparsers.add_parser('get_rpc_methods', help='Get list of supported RPC methods')
    p = subparsers.add_parser('rpc_get_methods', help='Get list of supported RPC methods', aliases=['get_rpc_methods'])
    p.add_argument('-c', '--current', help='Get list of RPC methods only callable in the current state.', action='store_true')
    p.set_defaults(func=get_rpc_methods)
    p.set_defaults(func=rpc_get_methods)

    def get_spdk_version(args):
        print(rpc.get_spdk_version(args.client))
Loading