bdev/raid: Add JSON config dump
Change-Id: I5b2832aad585145e021e26ac288da91ece2153a9 Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/426289 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
9d1b8599ea
commit
ed6a63d569
@ -696,6 +696,44 @@ raid_bdev_dump_info_json(void *ctx, struct spdk_json_write_ctx *w)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* brief:
|
||||||
|
* raid_bdev_write_config_json is the function table pointer for raid bdev
|
||||||
|
* params:
|
||||||
|
* bdev - pointer to spdk_bdev
|
||||||
|
* w - pointer to json context
|
||||||
|
* returns:
|
||||||
|
* none
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
raid_bdev_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w)
|
||||||
|
{
|
||||||
|
struct raid_bdev *raid_bdev = bdev->ctxt;
|
||||||
|
struct spdk_bdev *base;
|
||||||
|
uint16_t i;
|
||||||
|
|
||||||
|
spdk_json_write_object_begin(w);
|
||||||
|
|
||||||
|
spdk_json_write_named_string(w, "method", "construct_raid_bdev");
|
||||||
|
|
||||||
|
spdk_json_write_named_object_begin(w, "params");
|
||||||
|
spdk_json_write_named_string(w, "name", bdev->name);
|
||||||
|
spdk_json_write_named_uint32(w, "strip_size", raid_bdev->strip_size);
|
||||||
|
spdk_json_write_named_uint32(w, "raid_level", raid_bdev->raid_level);
|
||||||
|
|
||||||
|
spdk_json_write_named_array_begin(w, "base_bdevs");
|
||||||
|
for (i = 0; i < raid_bdev->num_base_bdevs; i++) {
|
||||||
|
base = raid_bdev->base_bdev_info[i].bdev;
|
||||||
|
if (base) {
|
||||||
|
spdk_json_write_string(w, base->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
spdk_json_write_array_end(w);
|
||||||
|
spdk_json_write_object_end(w);
|
||||||
|
|
||||||
|
spdk_json_write_object_end(w);
|
||||||
|
}
|
||||||
|
|
||||||
/* g_raid_bdev_fn_table is the function table for raid bdev */
|
/* g_raid_bdev_fn_table is the function table for raid bdev */
|
||||||
static const struct spdk_bdev_fn_table g_raid_bdev_fn_table = {
|
static const struct spdk_bdev_fn_table g_raid_bdev_fn_table = {
|
||||||
.destruct = raid_bdev_destruct,
|
.destruct = raid_bdev_destruct,
|
||||||
@ -703,6 +741,7 @@ static const struct spdk_bdev_fn_table g_raid_bdev_fn_table = {
|
|||||||
.io_type_supported = raid_bdev_io_type_supported,
|
.io_type_supported = raid_bdev_io_type_supported,
|
||||||
.get_io_channel = raid_bdev_get_io_channel,
|
.get_io_channel = raid_bdev_get_io_channel,
|
||||||
.dump_info_json = raid_bdev_dump_info_json,
|
.dump_info_json = raid_bdev_dump_info_json,
|
||||||
|
.write_config_json = raid_bdev_write_config_json,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -339,6 +339,18 @@ spdk_json_write_object_begin(struct spdk_json_write_ctx *w)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
spdk_json_write_named_object_begin(struct spdk_json_write_ctx *w, const char *name)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
spdk_json_write_named_array_begin(struct spdk_json_write_ctx *w, const char *name)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_json_write_array_end(struct spdk_json_write_ctx *w)
|
spdk_json_write_array_end(struct spdk_json_write_ctx *w)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user