bdev: remove get_bdevs_config RPC
This RPC does not work for a lot of bdev types. For example, NVMe namespaces and virtio scsi LUNs are not explicitly constructed by an RPC - they are indirectly constructed by an RPC associated with an NVMe controller or virtio-scsi controller. While here, remove spdk_bdev_config_json. It was only created to facilitate this get_bdevs_config RPC. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I537166d8f91ab458bd2000859d74f7254bfc9c0a Reviewed-on: https://review.gerrithub.io/424584 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
a7bafb6121
commit
ba38785b7e
@ -231,7 +231,6 @@ Example response:
|
||||
"set_bdev_options",
|
||||
"set_bdev_qos_limit_iops",
|
||||
"delete_bdev",
|
||||
"get_bdevs_config",
|
||||
"get_bdevs",
|
||||
"get_bdevs_iostat",
|
||||
"get_subsystem_config",
|
||||
|
@ -279,21 +279,6 @@ bool spdk_bdev_io_type_supported(struct spdk_bdev *bdev, enum spdk_bdev_io_type
|
||||
*/
|
||||
int spdk_bdev_dump_info_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w);
|
||||
|
||||
/**
|
||||
* Output bdev-specific configuration to a JSON stream.
|
||||
*
|
||||
* If supported, the object with following keys will be written:
|
||||
* method - name of the constructor method
|
||||
* params - parameters necessary to recreate this \c bdev
|
||||
*
|
||||
* If \c bdev does not support writing JSON configuration then object will be written
|
||||
* with only one key - the name of this bdev.
|
||||
*
|
||||
* \param bdev block device to query configuration.
|
||||
* \param w pointer to a JSON write context where \c bdev the configuration will be written.
|
||||
*/
|
||||
void spdk_bdev_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w);
|
||||
|
||||
/**
|
||||
* Get block device name.
|
||||
*
|
||||
|
@ -547,7 +547,9 @@ spdk_bdev_subsystem_config_json(struct spdk_json_write_ctx *w)
|
||||
}
|
||||
|
||||
TAILQ_FOREACH(bdev, &g_bdev_mgr.bdevs, internal.link) {
|
||||
spdk_bdev_config_json(bdev, w);
|
||||
if (bdev->fn_table->write_config_json) {
|
||||
bdev->fn_table->write_config_json(bdev, w);
|
||||
}
|
||||
}
|
||||
|
||||
spdk_json_write_array_end(w);
|
||||
@ -1365,17 +1367,6 @@ spdk_bdev_dump_info_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
spdk_bdev_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w)
|
||||
{
|
||||
assert(bdev != NULL);
|
||||
assert(w != NULL);
|
||||
|
||||
if (bdev->fn_table->write_config_json) {
|
||||
bdev->fn_table->write_config_json(bdev, w);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
spdk_bdev_qos_update_max_quota_per_timeslice(struct spdk_bdev_qos *qos)
|
||||
{
|
||||
|
@ -350,68 +350,6 @@ invalid:
|
||||
}
|
||||
SPDK_RPC_REGISTER("get_bdevs", spdk_rpc_get_bdevs, SPDK_RPC_RUNTIME)
|
||||
|
||||
struct rpc_get_bdevs_config {
|
||||
char *name;
|
||||
};
|
||||
|
||||
static void
|
||||
free_rpc_get_bdevs_config(struct rpc_get_bdevs_config *r)
|
||||
{
|
||||
free(r->name);
|
||||
}
|
||||
|
||||
static const struct spdk_json_object_decoder rpc_dump_bdevs_config_decoders[] = {
|
||||
{"name", offsetof(struct rpc_get_bdevs_config, name), spdk_json_decode_string, true},
|
||||
};
|
||||
|
||||
static void
|
||||
spdk_rpc_get_bdevs_config(struct spdk_jsonrpc_request *request,
|
||||
const struct spdk_json_val *params)
|
||||
{
|
||||
struct rpc_get_bdevs_config req = {};
|
||||
struct spdk_json_write_ctx *w;
|
||||
struct spdk_bdev *bdev = NULL;
|
||||
|
||||
if (params && spdk_json_decode_object(params, rpc_dump_bdevs_config_decoders,
|
||||
SPDK_COUNTOF(rpc_dump_bdevs_config_decoders),
|
||||
&req)) {
|
||||
SPDK_ERRLOG("spdk_json_decode_object failed\n");
|
||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS, "Invalid parameters");
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.name) {
|
||||
bdev = spdk_bdev_get_by_name(req.name);
|
||||
if (bdev == NULL) {
|
||||
SPDK_ERRLOG("bdev '%s' does not exist\n", req.name);
|
||||
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"Bdev '%s' not exist", req.name);
|
||||
free_rpc_get_bdevs_config(&req);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
free_rpc_get_bdevs_config(&req);
|
||||
w = spdk_jsonrpc_begin_result(request);
|
||||
if (w == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
spdk_json_write_array_begin(w);
|
||||
if (bdev != NULL) {
|
||||
spdk_bdev_config_json(bdev, w);
|
||||
} else {
|
||||
for (bdev = spdk_bdev_first(); bdev != NULL; bdev = spdk_bdev_next(bdev)) {
|
||||
spdk_bdev_config_json(bdev, w);
|
||||
}
|
||||
}
|
||||
|
||||
spdk_json_write_array_end(w);
|
||||
|
||||
spdk_jsonrpc_end_result(request, w);
|
||||
}
|
||||
SPDK_RPC_REGISTER("get_bdevs_config", spdk_rpc_get_bdevs_config, SPDK_RPC_RUNTIME)
|
||||
|
||||
struct rpc_delete_bdev {
|
||||
char *name;
|
||||
};
|
||||
|
@ -402,16 +402,6 @@ if __name__ == "__main__":
|
||||
p.add_argument('-b', '--name', help="Name of the Blockdev. Example: Nvme0n1", required=False)
|
||||
p.set_defaults(func=get_bdevs)
|
||||
|
||||
@call_cmd
|
||||
def get_bdevs_config(args):
|
||||
print_dict(rpc.bdev.get_bdevs_config(args.client,
|
||||
name=args.name))
|
||||
|
||||
p = subparsers.add_parser(
|
||||
'get_bdevs_config', help='Display current (live) blockdev configuration list or required blockdev')
|
||||
p.add_argument('-b', '--name', help="Name of the Blockdev. Example: Nvme0n1", required=False)
|
||||
p.set_defaults(func=get_bdevs_config)
|
||||
|
||||
@call_cmd
|
||||
def get_bdevs_iostat(args):
|
||||
print_dict(rpc.bdev.get_bdevs_iostat(args.client,
|
||||
|
@ -415,21 +415,6 @@ def get_bdevs(client, name=None):
|
||||
return client.call('get_bdevs', params)
|
||||
|
||||
|
||||
def get_bdevs_config(client, name=None):
|
||||
"""Get configuration for block devices.
|
||||
|
||||
Args:
|
||||
name: bdev name to query (optional; if omitted, query all bdevs)
|
||||
|
||||
Returns:
|
||||
List of RPC methods to reproduce the current bdev configuration.
|
||||
"""
|
||||
params = {}
|
||||
if name:
|
||||
params['name'] = name
|
||||
return client.call('get_bdevs_config', params)
|
||||
|
||||
|
||||
def get_bdevs_iostat(client, name=None):
|
||||
"""Get I/O statistics for block devices.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user