RPC: rename get_subsystem_config to framework_get_config

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: Ia0d20a04cf2dd5b23ad201d2ae9677a703ec92f3
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468682
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Maciej Wawryk 2019-09-18 12:09:24 +02:00 committed by Jim Harris
parent 8710b60062
commit 378ad60b88
7 changed files with 26 additions and 23 deletions

View File

@ -275,7 +275,7 @@ Example response:
"bdev_set_qos_limit", "bdev_set_qos_limit",
"bdev_get_bdevs", "bdev_get_bdevs",
"bdev_get_iostat", "bdev_get_iostat",
"get_subsystem_config", "framework_get_config",
"framework_get_subsystems", "framework_get_subsystems",
"framework_monitor_context_switch", "framework_monitor_context_switch",
"spdk_kill_instance", "spdk_kill_instance",
@ -402,9 +402,9 @@ Example response:
} }
~~~ ~~~
## get_subsystem_config {#rpc_get_subsystem_config} ## framework_get_config {#rpc_framework_get_config}
Get current configuration of the specified SPDK subsystem Get current configuration of the specified SPDK framework
### Parameters ### Parameters
@ -415,7 +415,7 @@ name | Required | string | SPDK subsystem name
### Response ### Response
The response is current configuration of the specified SPDK subsystem. The response is current configuration of the specified SPDK subsystem.
Null is returned if it is not retrievable by the get_subsystem_config method and empty array is returned if it is empty. Null is returned if it is not retrievable by the framework_get_config method and empty array is returned if it is empty.
### Example ### Example
@ -425,7 +425,7 @@ Example request:
{ {
"jsonrpc": "2.0", "jsonrpc": "2.0",
"id": 1, "id": 1,
"method": "get_subsystem_config", "method": "framework_get_config",
"params": { "params": {
"name": "bdev" "name": "bdev"
} }

View File

@ -74,24 +74,24 @@ spdk_rpc_framework_get_subsystems(struct spdk_jsonrpc_request *request,
SPDK_RPC_REGISTER("framework_get_subsystems", spdk_rpc_framework_get_subsystems, SPDK_RPC_RUNTIME) SPDK_RPC_REGISTER("framework_get_subsystems", spdk_rpc_framework_get_subsystems, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(framework_get_subsystems, get_subsystems) SPDK_RPC_REGISTER_ALIAS_DEPRECATED(framework_get_subsystems, get_subsystems)
struct rpc_get_subsystem_config { struct rpc_framework_get_config {
char *name; char *name;
}; };
static const struct spdk_json_object_decoder rpc_get_subsystem_config[] = { static const struct spdk_json_object_decoder rpc_framework_get_config[] = {
{"name", offsetof(struct rpc_get_subsystem_config, name), spdk_json_decode_string}, {"name", offsetof(struct rpc_framework_get_config, name), spdk_json_decode_string},
}; };
static void static void
spdk_rpc_get_subsystem_config(struct spdk_jsonrpc_request *request, spdk_rpc_framework_get_config(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params) const struct spdk_json_val *params)
{ {
struct rpc_get_subsystem_config req = {}; struct rpc_framework_get_config req = {};
struct spdk_json_write_ctx *w; struct spdk_json_write_ctx *w;
struct spdk_subsystem *subsystem; struct spdk_subsystem *subsystem;
if (spdk_json_decode_object(params, rpc_get_subsystem_config, if (spdk_json_decode_object(params, rpc_framework_get_config,
SPDK_COUNTOF(rpc_get_subsystem_config), &req)) { SPDK_COUNTOF(rpc_framework_get_config), &req)) {
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, "Invalid arguments"); spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, "Invalid arguments");
return; return;
} }
@ -111,4 +111,5 @@ spdk_rpc_get_subsystem_config(struct spdk_jsonrpc_request *request,
spdk_jsonrpc_end_result(request, w); spdk_jsonrpc_end_result(request, w);
} }
SPDK_RPC_REGISTER("get_subsystem_config", spdk_rpc_get_subsystem_config, SPDK_RPC_RUNTIME) SPDK_RPC_REGISTER("framework_get_config", spdk_rpc_framework_get_config, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(framework_get_config, get_subsystem_config)

View File

@ -1836,12 +1836,13 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
entry contain (unsorted) array of subsystems it depends on.""") entry contain (unsorted) array of subsystems it depends on.""")
p.set_defaults(func=framework_get_subsystems) p.set_defaults(func=framework_get_subsystems)
def get_subsystem_config(args): def framework_get_config(args):
print_dict(rpc.subsystem.get_subsystem_config(args.client, args.name)) print_dict(rpc.subsystem.framework_get_config(args.client, args.name))
p = subparsers.add_parser('get_subsystem_config', help="""Print subsystem configuration""") p = subparsers.add_parser('framework_get_config', aliases=['get_subsystem_config'],
help="""Print subsystem configuration""")
p.add_argument('name', help='Name of subsystem to query') p.add_argument('name', help='Name of subsystem to query')
p.set_defaults(func=get_subsystem_config) p.set_defaults(func=framework_get_config)
# vhost # vhost
def set_vhost_controller_coalescing(args): def set_vhost_controller_coalescing(args):

View File

@ -79,7 +79,7 @@ def save_config(client, fd, indent=2):
for elem in client.call('framework_get_subsystems'): for elem in client.call('framework_get_subsystems'):
cfg = { cfg = {
'subsystem': elem['subsystem'], 'subsystem': elem['subsystem'],
'config': client.call('get_subsystem_config', {"name": elem['subsystem']}) 'config': client.call('framework_get_config', {"name": elem['subsystem']})
} }
config['subsystems'].append(cfg) config['subsystems'].append(cfg)
@ -149,7 +149,7 @@ def save_subsystem_config(client, fd, indent=2, name=None):
""" """
cfg = { cfg = {
'subsystem': name, 'subsystem': name,
'config': client.call('get_subsystem_config', {"name": name}) 'config': client.call('framework_get_config', {"name": name})
} }
_json_dump(cfg, fd, indent) _json_dump(cfg, fd, indent)

View File

@ -6,6 +6,7 @@ def framework_get_subsystems(client):
return client.call('framework_get_subsystems') return client.call('framework_get_subsystems')
def get_subsystem_config(client, name): @deprecated_alias('get_subsystem_config')
def framework_get_config(client, name):
params = {'name': name} params = {'name': name}
return client.call('get_subsystem_config', params) return client.call('framework_get_config', params)

View File

@ -185,7 +185,7 @@ if __name__ == "__main__":
@call_test_cmd @call_test_cmd
def clear_subsystem(args): def clear_subsystem(args):
config = args.client.call('get_subsystem_config', {"name": args.subsystem}) config = args.client.call('framework_get_config', {"name": args.subsystem})
if config is None: if config is None:
return return
if args.verbose: if args.verbose:

View File

@ -17,7 +17,7 @@ nvmfappstart "-m 0xF"
$rootdir/scripts/gen_nvme.sh --json | $rpc_py load_subsystem_config $rootdir/scripts/gen_nvme.sh --json | $rpc_py load_subsystem_config
local_nvme_trid="trtype:PCIe traddr:"$($rpc_py get_subsystem_config bdev | jq -r '.[].params | select(.name=="Nvme0").traddr') local_nvme_trid="trtype:PCIe traddr:"$($rpc_py framework_get_config bdev | jq -r '.[].params | select(.name=="Nvme0").traddr')
bdevs="$bdevs $($rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)" bdevs="$bdevs $($rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
if [ -n "$local_nvme_trid" ]; then if [ -n "$local_nvme_trid" ]; then