RPC: rename rpc get_raid_bdevs to bdev_raid_get_bdevs

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I92a42d61ac8a189827a6abb229aa9b97084beabb
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467914
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Pawel Kaminski <pawelx.kaminski@intel.com>
This commit is contained in:
Maciej Wawryk 2019-09-10 10:27:50 +02:00 committed by Jim Harris
parent c2a4f329d2
commit b9477173a3
7 changed files with 38 additions and 34 deletions

View File

@ -485,7 +485,7 @@ Example commands
`rpc.py construct_raid_bdev -n Raid0 -z 64 -r 0 -b "lvol0 lvol1 lvol2 lvol3"`
`rpc.py get_raid_bdevs`
`rpc.py bdev_raid_get_bdevs`
`rpc.py destroy_raid_bdev Raid0`

View File

@ -5288,7 +5288,7 @@ Example response:
# RAID
## get_raid_bdevs {#rpc_get_raid_bdevs}
## bdev_raid_get_bdevs {#rpc_bdev_raid_get_bdevs}
This is used to list all the raid bdev names based on the input category requested. Category should be one
of 'all', 'online', 'configuring' or 'offline'. 'all' means all the raid bdevs whether they are online or
@ -5310,7 +5310,7 @@ Example request:
~~~
{
"jsonrpc": "2.0",
"method": "get_raid_bdevs",
"method": "bdev_raid_get_bdevs",
"id": 1,
"params": {
"category": "all"

View File

@ -44,23 +44,23 @@
SPDK_LOG_REGISTER_COMPONENT("raidrpc", SPDK_LOG_RAID_RPC)
/*
* Input structure for get_raid_bdevs RPC
* Input structure for bdev_raid_get_bdevs RPC
*/
struct rpc_get_raid_bdevs {
struct rpc_bdev_raid_get_bdevs {
/* category - all or online or configuring or offline */
char *category;
};
/*
* brief:
* free_rpc_get_raids function frees RPC get_raids related parameters
* free_rpc_bdev_raid_get_bdevs function frees RPC bdev_raid_get_bdevs related parameters
* params:
* req - pointer to RPC request
* returns:
* none
*/
static void
free_rpc_get_raid_bdevs(struct rpc_get_raid_bdevs *req)
free_rpc_bdev_raid_get_bdevs(struct rpc_bdev_raid_get_bdevs *req)
{
free(req->category);
}
@ -68,13 +68,13 @@ free_rpc_get_raid_bdevs(struct rpc_get_raid_bdevs *req)
/*
* Decoder object for RPC get_raids
*/
static const struct spdk_json_object_decoder rpc_get_raid_bdevs_decoders[] = {
{"category", offsetof(struct rpc_get_raid_bdevs, category), spdk_json_decode_string},
static const struct spdk_json_object_decoder rpc_bdev_raid_get_bdevs_decoders[] = {
{"category", offsetof(struct rpc_bdev_raid_get_bdevs, category), spdk_json_decode_string},
};
/*
* brief:
* spdk_rpc_get_raids function is the RPC for get_raids. This is used to list
* spdk_rpc_bdev_raid_get_bdevs function is the RPC for spdk_rpc_bdev_raid_get_bdevs. This is used to list
* all the raid bdev names based on the input category requested. Category should be
* one of "all", "online", "configuring" or "offline". "all" means all the raids
* whether they are online or configuring or offline. "online" is the raid bdev which
@ -89,15 +89,15 @@ static const struct spdk_json_object_decoder rpc_get_raid_bdevs_decoders[] = {
* none
*/
static void
spdk_rpc_get_raid_bdevs(struct spdk_jsonrpc_request *request,
spdk_rpc_bdev_raid_get_bdevs(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct rpc_get_raid_bdevs req = {};
struct rpc_bdev_raid_get_bdevs req = {};
struct spdk_json_write_ctx *w;
struct raid_bdev *raid_bdev;
if (spdk_json_decode_object(params, rpc_get_raid_bdevs_decoders,
SPDK_COUNTOF(rpc_get_raid_bdevs_decoders),
if (spdk_json_decode_object(params, rpc_bdev_raid_get_bdevs_decoders,
SPDK_COUNTOF(rpc_bdev_raid_get_bdevs_decoders),
&req)) {
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
"spdk_json_decode_object failed");
@ -137,9 +137,10 @@ spdk_rpc_get_raid_bdevs(struct spdk_jsonrpc_request *request,
spdk_jsonrpc_end_result(request, w);
cleanup:
free_rpc_get_raid_bdevs(&req);
free_rpc_bdev_raid_get_bdevs(&req);
}
SPDK_RPC_REGISTER("get_raid_bdevs", spdk_rpc_get_raid_bdevs, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER("bdev_raid_get_bdevs", spdk_rpc_bdev_raid_get_bdevs, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(bdev_raid_get_bdevs, get_raid_bdevs)
/*
* Base bdevs in RPC construct_raid

View File

@ -1321,17 +1321,18 @@ Format: 'user:u1 secret:s1 muser:mu1 msecret:ms1,user:u2 secret:s2 muser:mu2 mse
p.add_argument('-l', '--lvs-name', help='lvol store name', required=False)
p.set_defaults(func=bdev_lvol_get_lvstores)
def get_raid_bdevs(args):
print_array(rpc.bdev.get_raid_bdevs(args.client,
def bdev_raid_get_bdevs(args):
print_array(rpc.bdev.bdev_raid_get_bdevs(args.client,
category=args.category))
p = subparsers.add_parser('get_raid_bdevs', help="""This is used to list all the raid bdev names based on the input category
p = subparsers.add_parser('bdev_raid_get_bdevs', aliases=['get_raid_bdevs'],
help="""This is used to list all the raid bdev names based on the input category
requested. Category should be one of 'all', 'online', 'configuring' or 'offline'. 'all' means all the raid bdevs whether
they are online or configuring or offline. 'online' is the raid bdev which is registered with bdev layer. 'configuring'
is the raid bdev which does not have full configuration discovered yet. 'offline' is the raid bdev which is not registered
with bdev as of now and it has encountered any error or user has requested to offline the raid bdev""")
p.add_argument('category', help='all or online or configuring or offline')
p.set_defaults(func=get_raid_bdevs)
p.set_defaults(func=bdev_raid_get_bdevs)
def construct_raid_bdev(args):
base_bdevs = []

View File

@ -235,7 +235,8 @@ def bdev_null_delete(client, name):
return client.call('bdev_null_delete', params)
def get_raid_bdevs(client, category):
@deprecated_alias('get_raid_bdevs')
def bdev_raid_get_bdevs(client, category):
"""Get list of raid bdevs based on category
Args:
@ -245,7 +246,7 @@ def get_raid_bdevs(client, category):
List of raid bdev names
"""
params = {'category': category}
return client.call('get_raid_bdevs', params)
return client.call('bdev_raid_get_bdevs', params)
def construct_raid_bdev(client, name, raid_level, base_bdevs, strip_size=None, strip_size_kb=None):

View File

@ -81,7 +81,7 @@ function raid_function_test() {
waitforlisten $raid_pid $rpc_server
configure_raid_bdev
raid_bdev=$($rpc_py get_raid_bdevs online | cut -d ' ' -f 1)
raid_bdev=$($rpc_py bdev_raid_get_bdevs online | cut -d ' ' -f 1)
if [ $raid_bdev = "" ]; then
echo "No raid0 device in SPDK app"
return 1

View File

@ -114,6 +114,7 @@ DEFINE_STUB(spdk_conf_next_section, struct spdk_conf_section *, (struct spdk_con
NULL);
DEFINE_STUB_V(spdk_rpc_register_method, (const char *method, spdk_rpc_method_handler func,
uint32_t state_mask));
DEFINE_STUB_V(spdk_rpc_register_alias_deprecated, (const char *method, const char *alias));
DEFINE_STUB_V(spdk_jsonrpc_end_result, (struct spdk_jsonrpc_request *request,
struct spdk_json_write_ctx *w));
DEFINE_STUB(spdk_json_decode_string, int, (const struct spdk_json_val *val, void *out), 0);
@ -1132,7 +1133,7 @@ create_destroy_req(struct rpc_destroy_raid_bdev *r, const char *raid_name,
}
static void
create_get_raids_req(struct rpc_get_raid_bdevs *r, const char *category,
create_get_raids_req(struct rpc_bdev_raid_get_bdevs *r, const char *category,
uint8_t json_decode_obj_err)
{
r->category = strdup(category);
@ -1855,7 +1856,7 @@ test_multi_raid_no_io(void)
{
struct rpc_construct_raid_bdev *construct_req;
struct rpc_destroy_raid_bdev destroy_req;
struct rpc_get_raid_bdevs get_raids_req;
struct rpc_bdev_raid_get_bdevs get_raids_req;
uint8_t i;
char name[16];
uint8_t bbdev_idx = 0;
@ -1877,7 +1878,7 @@ test_multi_raid_no_io(void)
}
create_get_raids_req(&get_raids_req, "all", 0);
spdk_rpc_get_raid_bdevs(NULL, NULL);
spdk_rpc_bdev_raid_get_bdevs(NULL, NULL);
CU_ASSERT(g_rpc_err == 0);
verify_get_raids(construct_req, g_max_raids, g_get_raids_output, g_get_raids_count);
for (i = 0; i < g_get_raids_count; i++) {
@ -1885,7 +1886,7 @@ test_multi_raid_no_io(void)
}
create_get_raids_req(&get_raids_req, "online", 0);
spdk_rpc_get_raid_bdevs(NULL, NULL);
spdk_rpc_bdev_raid_get_bdevs(NULL, NULL);
CU_ASSERT(g_rpc_err == 0);
verify_get_raids(construct_req, g_max_raids, g_get_raids_output, g_get_raids_count);
for (i = 0; i < g_get_raids_count; i++) {
@ -1893,28 +1894,28 @@ test_multi_raid_no_io(void)
}
create_get_raids_req(&get_raids_req, "configuring", 0);
spdk_rpc_get_raid_bdevs(NULL, NULL);
spdk_rpc_bdev_raid_get_bdevs(NULL, NULL);
CU_ASSERT(g_rpc_err == 0);
CU_ASSERT(g_get_raids_count == 0);
create_get_raids_req(&get_raids_req, "offline", 0);
spdk_rpc_get_raid_bdevs(NULL, NULL);
spdk_rpc_bdev_raid_get_bdevs(NULL, NULL);
CU_ASSERT(g_rpc_err == 0);
CU_ASSERT(g_get_raids_count == 0);
create_get_raids_req(&get_raids_req, "invalid_category", 0);
spdk_rpc_get_raid_bdevs(NULL, NULL);
spdk_rpc_bdev_raid_get_bdevs(NULL, NULL);
CU_ASSERT(g_rpc_err == 1);
CU_ASSERT(g_get_raids_count == 0);
create_get_raids_req(&get_raids_req, "all", 1);
spdk_rpc_get_raid_bdevs(NULL, NULL);
spdk_rpc_bdev_raid_get_bdevs(NULL, NULL);
CU_ASSERT(g_rpc_err == 1);
free(get_raids_req.category);
CU_ASSERT(g_get_raids_count == 0);
create_get_raids_req(&get_raids_req, "all", 0);
spdk_rpc_get_raid_bdevs(NULL, NULL);
spdk_rpc_bdev_raid_get_bdevs(NULL, NULL);
CU_ASSERT(g_rpc_err == 0);
CU_ASSERT(g_get_raids_count == g_max_raids);
for (i = 0; i < g_get_raids_count; i++) {