rpc: Rename construct_pmem_bdev to bdev_pmem_create

Change-Id: I8cc7a13e45395c19f67d6b22d01a2542cc18634c
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/466703
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Pawel Kaminski 2019-08-29 05:54:36 -04:00 committed by Ben Walker
parent 61a42c0e64
commit f208699589
15 changed files with 72 additions and 69 deletions

View File

@ -527,12 +527,12 @@ Example command
`rpc.py delete_pmem_pool /path/to/pmem_pool`
To create bdev based on pmemblk pool file user should use `construct_pmem_bdev ` RPC
To create bdev based on pmemblk pool file user should use `bdev_pmem_create ` RPC
command.
Example command
`rpc.py construct_pmem_bdev /path/to/pmem_pool -n pmem`
`rpc.py bdev_pmem_create /path/to/pmem_pool -n pmem`
To remove a block device representation use the delete_pmem_bdev command.

View File

@ -2231,7 +2231,7 @@ Example response:
}
~~~
## construct_pmem_bdev {#rpc_construct_pmem_bdev}
## bdev_pmem_create {#rpc_bdev_pmem_create}
Construct @ref bdev_config_pmem bdev.
@ -2259,7 +2259,7 @@ Example request:
"name": "Pmem0"
},
"jsonrpc": "2.0",
"method": "construct_pmem_bdev",
"method": "bdev_pmem_create",
"id": 1
}
~~~

View File

@ -290,7 +290,7 @@ bdev_pmem_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *
spdk_json_write_object_begin(w);
spdk_json_write_named_string(w, "method", "construct_pmem_bdev");
spdk_json_write_named_string(w, "method", "bdev_pmem_create");
spdk_json_write_named_object_begin(w, "params");
spdk_json_write_named_string(w, "name", bdev->name);

View File

@ -45,7 +45,7 @@ struct rpc_construct_pmem {
};
static void
free_rpc_construct_pmem_bdev(struct rpc_construct_pmem *req)
free_rpc_bdev_pmem_create(struct rpc_construct_pmem *req)
{
free(req->pmem_file);
free(req->name);
@ -57,8 +57,8 @@ static const struct spdk_json_object_decoder rpc_construct_pmem_decoders[] = {
};
static void
spdk_rpc_construct_pmem_bdev(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
spdk_rpc_bdev_pmem_create(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct rpc_construct_pmem req = {};
struct spdk_json_write_ctx *w;
@ -84,9 +84,10 @@ spdk_rpc_construct_pmem_bdev(struct spdk_jsonrpc_request *request,
spdk_jsonrpc_end_result(request, w);
cleanup:
free_rpc_construct_pmem_bdev(&req);
free_rpc_bdev_pmem_create(&req);
}
SPDK_RPC_REGISTER("construct_pmem_bdev", spdk_rpc_construct_pmem_bdev, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER("bdev_pmem_create", spdk_rpc_bdev_pmem_create, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(bdev_pmem_create, construct_pmem_bdev)
struct rpc_delete_pmem {
char *name;

View File

@ -14,7 +14,7 @@ bdev_dict["construct_nvme_bdev"] = []
bdev_dict["bdev_nvme_set_hotplug"] = []
bdev_dict["bdev_malloc_create"] = []
bdev_dict["bdev_aio_create"] = []
bdev_dict["construct_pmem_bdev"] = []
bdev_dict["bdev_pmem_create"] = []
bdev_dict["construct_virtio_dev"] = []
vhost_dict = OrderedDict()
@ -258,7 +258,7 @@ def get_pmem_bdev_json(config, section):
"name": items[1],
"pmem_file": items[0]
},
"method": "construct_pmem_bdev"
"method": "bdev_pmem_create"
})
return pmem_json

View File

@ -529,15 +529,16 @@ if __name__ == "__main__":
p.add_argument('name', help='iSCSI bdev name')
p.set_defaults(func=bdev_iscsi_delete)
def construct_pmem_bdev(args):
print_json(rpc.bdev.construct_pmem_bdev(args.client,
pmem_file=args.pmem_file,
name=args.name))
def bdev_pmem_create(args):
print_json(rpc.bdev.bdev_pmem_create(args.client,
pmem_file=args.pmem_file,
name=args.name))
p = subparsers.add_parser('construct_pmem_bdev', help='Add a bdev with pmem backend')
p = subparsers.add_parser('bdev_pmem_create', aliases=['construct_pmem_bdev'],
help='Add a bdev with pmem backend')
p.add_argument('pmem_file', help='Path to pmemblk pool file')
p.add_argument('-n', '--name', help='Block device name', required=True)
p.set_defaults(func=construct_pmem_bdev)
p.set_defaults(func=bdev_pmem_create)
def delete_pmem_bdev(args):
rpc.bdev.delete_pmem_bdev(args.client,

View File

@ -578,7 +578,8 @@ def bdev_iscsi_delete(client, name):
return client.call('bdev_iscsi_delete', params)
def construct_pmem_bdev(client, pmem_file, name):
@deprecated_alias('construct_pmem_bdev')
def bdev_pmem_create(client, pmem_file, name):
"""Construct a libpmemblk block device.
Args:
@ -592,7 +593,7 @@ def construct_pmem_bdev(client, pmem_file, name):
'pmem_file': pmem_file,
'name': name
}
return client.call('construct_pmem_bdev', params)
return client.call('bdev_pmem_create', params)
def delete_pmem_bdev(client, name):

View File

@ -442,7 +442,7 @@ class UIPmemBdev(UIBdev):
self.shell.log.info(json.dumps(ret, indent=2))
def ui_command_create(self, pmem_file, name):
ret_name = self.get_root().create_pmem_bdev(pmem_file=pmem_file,
ret_name = self.get_root().bdev_pmem_create(pmem_file=pmem_file,
name=name)
self.shell.log.info(ret_name)

View File

@ -220,8 +220,8 @@ class UIRoot(UINode):
return response
@verbose
def create_pmem_bdev(self, **kwargs):
response = rpc.bdev.construct_pmem_bdev(self.client, **kwargs)
def bdev_pmem_create(self, **kwargs):
response = rpc.bdev.bdev_pmem_create(self.client, **kwargs)
return response
@verbose

View File

@ -164,7 +164,7 @@
"name": "Pmem0",
"pmem_file": "/tmp/sample_pmem"
},
"method": "construct_pmem_bdev"
"method": "bdev_pmem_create"
}
]
},

View File

@ -39,7 +39,7 @@ for i in $(seq 1 $TGT_NR); do
luns=""
for j in $(seq 1 $PMEM_PER_TGT); do
$rpc_py create_pmem_pool /tmp/pool_file${i}_${j} $PMEM_SIZE $PMEM_BLOCK_SIZE
bdevs_name="$($rpc_py construct_pmem_bdev -n pmem${i}_${j} /tmp/pool_file${i}_${j})"
bdevs_name="$($rpc_py bdev_pmem_create -n pmem${i}_${j} /tmp/pool_file${i}_${j})"
PMEM_BDEVS+="$bdevs_name "
luns+="$bdevs_name:$((j - 1)) "
done

View File

@ -34,7 +34,7 @@ def get_bdev_destroy_method(bdev):
destroy_method_map = {'bdev_malloc_create': "delete_malloc_bdev",
'bdev_null_create': "bdev_null_delete",
'construct_rbd_bdev': "delete_rbd_bdev",
'construct_pmem_bdev': "delete_pmem_bdev",
'bdev_pmem_create': "delete_pmem_bdev",
'bdev_aio_create': "bdev_aio_delete",
'bdev_error_create': "bdev_error_delete",
'construct_split_vbdev': "destruct_split_vbdev",

View File

@ -233,7 +233,7 @@ function create_bdev_subsystem_config() {
pmem_pool_file=$(mktemp /tmp/pool_file1.XXXXX)
rm -f $pmem_pool_file
tgt_rpc create_pmem_pool $pmem_pool_file 128 4096
tgt_rpc construct_pmem_bdev -n pmem1 $pmem_pool_file
tgt_rpc bdev_pmem_create -n pmem1 $pmem_pool_file
expected_notifications+=( bdev_register:pmem1 )
fi

View File

@ -440,46 +440,46 @@ function delete_pmem_pool_tc4()
}
#================================================
# construct_pmem_bdev tests
# bdev_pmem_create tests
#================================================
function construct_pmem_bdev_tc1()
function bdev_pmem_create_tc1()
{
pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file
pmem_create_pool_file
if $rpc_py construct_pmem_bdev; then
error "construct_pmem_bdev passed with missing argument!"
if $rpc_py bdev_pmem_create; then
error "bdev_pmem_create passed with missing argument!"
fi
pmem_clean_pool_file
return 0
}
function construct_pmem_bdev_tc2()
function bdev_pmem_create_tc2()
{
pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file
pmem_create_pool_file
if $rpc_py construct_pmem_bdev -n $bdev_name $rootdir/non/existing/path/non_existent_file; then
if $rpc_py bdev_pmem_create -n $bdev_name $rootdir/non/existing/path/non_existent_file; then
error "Created pmem bdev w/out valid pool file!"
fi
if $rpc_py get_bdevs | jq -r '.[] .name' | grep -qi pmem; then
error "construct_pmem_bdev passed with invalid argument!"
error "bdev_pmem_create passed with invalid argument!"
fi
pmem_clean_pool_file
return 0
}
function construct_pmem_bdev_tc3()
function bdev_pmem_create_tc3()
{
pmem_print_tc_name ${FUNCNAME[0]}
truncate -s 32M $rootdir/test/pmem/random_file
if $rpc_py construct_pmem_bdev -n $bdev_name $rootdir/test/pmem/random_file; then
if $rpc_py bdev_pmem_create -n $bdev_name $rootdir/test/pmem/random_file; then
error "Created pmem bdev from random file!"
fi
@ -491,7 +491,7 @@ function construct_pmem_bdev_tc3()
return 0
}
function construct_pmem_bdev_tc4()
function bdev_pmem_create_tc4()
{
pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file $obj_pool_file
@ -504,7 +504,7 @@ function construct_pmem_bdev_tc4()
truncate -s "32M" $obj_pool_file
fi
if $rpc_py construct_pmem_bdev -n $bdev_name $obj_pool_file; then
if $rpc_py bdev_pmem_create -n $bdev_name $obj_pool_file; then
pmem_clean_pool_file $obj_pool_file
error "Created pmem bdev from obj type pmem file!"
fi
@ -513,7 +513,7 @@ function construct_pmem_bdev_tc4()
return 0
}
function construct_pmem_bdev_tc5()
function bdev_pmem_create_tc5()
{
pmem_print_tc_name ${FUNCNAME[0]}
pmem_clean_pool_file
@ -524,7 +524,7 @@ function construct_pmem_bdev_tc5()
error "Failed to get pmem info!"
fi
pmem_bdev_name=$($rpc_py construct_pmem_bdev -n $bdev_name $default_pool_file)
pmem_bdev_name=$($rpc_py bdev_pmem_create -n $bdev_name $default_pool_file)
if [ $? != 0 ]; then
error "Failed to create pmem bdev"
fi
@ -545,7 +545,7 @@ function construct_pmem_bdev_tc5()
return 0
}
function construct_pmem_bdev_tc6()
function bdev_pmem_create_tc6()
{
pmem_print_tc_name ${FUNCNAME[0]}
local pmem_bdev_name
@ -556,7 +556,7 @@ function construct_pmem_bdev_tc6()
error "Failed to get info on pmem pool file!"
fi
pmem_bdev_name=$($rpc_py construct_pmem_bdev -n $bdev_name $default_pool_file)
pmem_bdev_name=$($rpc_py bdev_pmem_create -n $bdev_name $default_pool_file)
if [ $? != 0 ]; then
error "Failed to create pmem bdev!"
fi
@ -565,7 +565,7 @@ function construct_pmem_bdev_tc6()
error "Pmem bdev not found!"
fi
if $rpc_py construct_pmem_bdev -n $bdev_name $default_pool_file; then
if $rpc_py bdev_pmem_create -n $bdev_name $default_pool_file; then
error "Constructed pmem bdev with occupied path!"
fi
@ -596,7 +596,7 @@ function delete_bdev_tc1()
error "Failed to get pmem info!"
fi
pmem_bdev_name=$($rpc_py construct_pmem_bdev -n $bdev_name $default_pool_file)
pmem_bdev_name=$($rpc_py bdev_pmem_create -n $bdev_name $default_pool_file)
if [ $? != 0 ]; then
error "Failed to create pmem bdev!"
fi
@ -629,7 +629,7 @@ function delete_bdev_tc2()
error "Failed to get pmem info!"
fi
pmem_bdev_name=$($rpc_py construct_pmem_bdev -n $bdev_name $default_pool_file)
pmem_bdev_name=$($rpc_py bdev_pmem_create -n $bdev_name $default_pool_file)
if [ $? != 0 ]; then
error "Failed to create pmem bdev"
fi
@ -683,12 +683,12 @@ if $test_delete || $test_all; then
fi
if $test_construct_bdev || $test_all; then
construct_pmem_bdev_tc1
construct_pmem_bdev_tc2
construct_pmem_bdev_tc3
construct_pmem_bdev_tc4
construct_pmem_bdev_tc5
construct_pmem_bdev_tc6
bdev_pmem_create_tc1
bdev_pmem_create_tc2
bdev_pmem_create_tc3
bdev_pmem_create_tc4
bdev_pmem_create_tc5
bdev_pmem_create_tc6
fi
if $test_delete_bdev || $test_all; then

View File

@ -199,46 +199,46 @@ Steps & expected results:
- call delete_pmem_pool on already deleted pmem pool
- return code !=0 and error code = ENODEV
### construct_pmem_bdev
### bdev_pmem_create
#### construct_pmem_bdev_tc1
#### bdev_pmem_create_tc1
Negative test for constructing new pmem bdev.
Call create_pmem_bdev with missing argument.
Call bdev_pmem_create with missing argument.
Steps & expected results:
- Call construct_pmem_bdev with missing path argument.
- Call bdev_pmem_create with missing path argument.
- Check that return code != 0
#### construct_pmem_bdev_tc2
#### bdev_pmem_create_tc2
Negative test for constructing new pmem bdev.
Call construct_pmem_bdev with not existing path argument.
Call bdev_pmem_create with not existing path argument.
Steps & expected results:
- call construct_pmem_bdev with incorrect (not existing) path
- call bdev_pmem_create with incorrect (not existing) path
- call return code != 0 and error code = ENODEV
- using get_bdevs check that no pmem bdev was created
#### construct_pmem_bdev_tc3
#### bdev_pmem_create_tc3
Negative test for constructing pmem bdevs with random file instead of pmemblk pool.
Steps & expected results:
- using a system tool (like dd) create a random file
- call construct_pmem_bdev with path pointing to that file
- call bdev_pmem_create with path pointing to that file
- return code != 0, error code = ENOTBLK
#### construct_pmem_bdev_tc4
#### bdev_pmem_create_tc4
Negative test for constructing pmem bdevs with pmemobj instead of pmemblk pool.
Steps & expected results:
- Using pmem utility tools create pool of OBJ type instead of BLK
(if needed utility tools are not available - create random file in filesystem)
- call construct_pmem_bdev with path pointing to that pool
- call bdev_pmem_create with path pointing to that pool
- return code != 0, error code = ENOTBLK
#### construct_pmem_bdev_tc5
#### bdev_pmem_create_tc5
Positive test for constructing pmem bdev.
Steps & expected results:
- call create_pmem_pool with correct arguments
- return code = 0, no errors
- call pmem_pool_info and check if pmem files exists
- return code = 0, no errors
- call construct_pmem_bdev with with correct arguments to create a pmem bdev
- call bdev_pmem_create with with correct arguments to create a pmem bdev
- return code = 0, no errors
- using get_bdevs check that pmem bdev was created
- delete pmem bdev using delete_pmem_bdev
@ -246,17 +246,17 @@ Steps & expected results:
- delete previously created pmem pool
- return code = 0, no error code
#### construct_pmem_bdev_tc6
#### bdev_pmem_create_tc6
Negative test for constructing pmem bdevs twice on the same pmem.
Steps & expected results:
- call create_pmem_pool with correct arguments
- return code = 0, no errors
- call pmem_pool_info and check if pmem files exists
- return code = 0, no errors
- call construct_pmem_bdev with with correct arguments to create a pmem bdev
- call bdev_pmem_create with with correct arguments to create a pmem bdev
- return code = 0, no errors
- using get_bdevs check that pmem bdev was created
- call construct_pmem_bdev again on the same pmem file
- call bdev_pmem_create again on the same pmem file
- return code != 0, error code = EEXIST
- delete pmem bdev using delete_pmem_bdev
- return code = 0, no error code
@ -275,7 +275,7 @@ block size=512, total size=256M
- return code = 0, no errors
- call pmem_pool_info and check if pmem file exists
- return code = 0, no errors
- call construct_pmem_bdev and create a pmem bdev
- call bdev_pmem_create and create a pmem bdev
- return code = 0, no errors
- using get_bdevs check that pmem bdev was created
- delete pmem bdev using delete_pmem_bdev
@ -291,7 +291,7 @@ block size=512, total size=256M
- return code = 0, no errors
- call pmem_pool_info and check if pmem file exists
- return code = 0, no errors
- call construct_pmem_bdev and create a pmem bdev
- call bdev_pmem_create and create a pmem bdev
- return code = 0, no errors
- using get_bdevs check that pmem bdev was created
- delete pmem bdev using delete_pmem_bdev