bdev: Enable lvol resize RPC
Enable test functions for lvol resize. Change-Id: Ia4583af211350054797d2d8441083e582e6e2ab7 Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com> Reviewed-on: https://review.gerrithub.io/395043 Reviewed-by: Maciej Szwed <maciej.szwed@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@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
f3e13c95d9
commit
7552707ef1
@ -191,7 +191,7 @@ fi
|
|||||||
|
|
||||||
if [ $SPDK_TEST_LVOL -eq 1 ]; then
|
if [ $SPDK_TEST_LVOL -eq 1 ]; then
|
||||||
timing_enter lvol
|
timing_enter lvol
|
||||||
test_cases="1,50,51,52,53,100,101,102,250,251,252,253,255,"
|
test_cases="1,50,51,52,53,100,101,102,150,200,201,250,251,252,253,254,255,"
|
||||||
test_cases+="300,301,450,451,452,550,600,601,650,651,652,654,655,"
|
test_cases+="300,301,450,451,452,550,600,601,650,651,652,654,655,"
|
||||||
test_cases+="700,701,800,801,802,803,804,10000"
|
test_cases+="700,701,800,801,802,803,804,10000"
|
||||||
run_test ./test/lvol/lvol.sh --test-cases=$test_cases
|
run_test ./test/lvol/lvol.sh --test-cases=$test_cases
|
||||||
|
@ -720,7 +720,7 @@ invalid:
|
|||||||
spdk_strerror(-lvolerrno));
|
spdk_strerror(-lvolerrno));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __attribute__((unused))
|
static void
|
||||||
spdk_rpc_resize_lvol_bdev(struct spdk_jsonrpc_request *request,
|
spdk_rpc_resize_lvol_bdev(struct spdk_jsonrpc_request *request,
|
||||||
const struct spdk_json_val *params)
|
const struct spdk_json_val *params)
|
||||||
{
|
{
|
||||||
@ -769,8 +769,7 @@ invalid:
|
|||||||
free_rpc_resize_lvol_bdev(&req);
|
free_rpc_resize_lvol_bdev(&req);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Logical volume resize feature is disabled, as it is currently work in progress
|
SPDK_RPC_REGISTER("resize_lvol_bdev", spdk_rpc_resize_lvol_bdev)
|
||||||
SPDK_RPC_REGISTER("resize_lvol_bdev", spdk_rpc_resize_lvol_bdev) */
|
|
||||||
|
|
||||||
struct rpc_get_lvol_stores {
|
struct rpc_get_lvol_stores {
|
||||||
char *uuid;
|
char *uuid;
|
||||||
|
@ -536,15 +536,14 @@ if __name__ == "__main__":
|
|||||||
p.add_argument('new_name', help='new lvol name')
|
p.add_argument('new_name', help='new lvol name')
|
||||||
p.set_defaults(func=rename_lvol_bdev)
|
p.set_defaults(func=rename_lvol_bdev)
|
||||||
|
|
||||||
# Logical volume resize feature is disabled, as it is currently work in progress
|
@call_cmd
|
||||||
# @call_cmd
|
def resize_lvol_bdev(args):
|
||||||
# def resize_lvol_bdev(args):
|
rpc.lvol.resize_lvol_bdev(args.client, args)
|
||||||
# rpc.lvol.resize_bdev(args.client, args)
|
|
||||||
#
|
p = subparsers.add_parser('resize_lvol_bdev', help='Resize existing lvol bdev')
|
||||||
# p = subparsers.add_parser('resize_lvol_bdev', help='Resize existing lvol bdev')
|
p.add_argument('name', help='lvol bdev name')
|
||||||
# p.add_argument('name', help='lvol bdev name')
|
p.add_argument('size', help='new size in MiB for this bdev', type=int)
|
||||||
# p.add_argument('size', help='new size in MiB for this bdev', type=int)
|
p.set_defaults(func=resize_lvol_bdev)
|
||||||
# p.set_defaults(func=resize_lvol_bdev)
|
|
||||||
|
|
||||||
@call_cmd
|
@call_cmd
|
||||||
def destroy_lvol_store(args):
|
def destroy_lvol_store(args):
|
||||||
|
@ -52,14 +52,13 @@ def rename_lvol_bdev(client, args):
|
|||||||
return client.call('rename_lvol_bdev', params)
|
return client.call('rename_lvol_bdev', params)
|
||||||
|
|
||||||
|
|
||||||
# Logical volume resize feature is disabled, as it is currently work in progress
|
def resize_lvol_bdev(client, args):
|
||||||
#
|
num_bytes = (args.size * 1024 * 1024)
|
||||||
# def resize_lvol_bdev(client, args):
|
params = {
|
||||||
# params = {
|
'name': args.name,
|
||||||
# 'name': args.name,
|
'size': num_bytes,
|
||||||
# 'size': args.size,
|
}
|
||||||
# }
|
return client.call('resize_lvol_bdev', params)
|
||||||
# return client.call('resize_lvol_bdev', params)
|
|
||||||
|
|
||||||
|
|
||||||
def destroy_lvol_store(client, args):
|
def destroy_lvol_store(client, args):
|
||||||
|
@ -386,22 +386,24 @@ class TestCases(object):
|
|||||||
fail_count = self.c.check_get_lvol_stores(base_name, uuid_store,
|
fail_count = self.c.check_get_lvol_stores(base_name, uuid_store,
|
||||||
self.cluster_size)
|
self.cluster_size)
|
||||||
# size is equal to one quarter of size malloc bdev
|
# size is equal to one quarter of size malloc bdev
|
||||||
uuid_bdev = self.c.construct_lvol_bdev(uuid_store,
|
size = self.total_size / 4
|
||||||
self.lbd_name,
|
uuid_bdev = self.c.construct_lvol_bdev(uuid_store, self.lbd_name, size)
|
||||||
self.total_size / 4)
|
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, size)
|
||||||
fail_count += self.c.check_get_bdevs_methods(uuid_bdev,
|
|
||||||
self.total_size / 4)
|
|
||||||
# size is equal to half of size malloc bdev
|
# size is equal to half of size malloc bdev
|
||||||
self.c.resize_lvol_bdev(uuid_bdev, self.total_size / 2)
|
size = self.total_size / 2
|
||||||
fail_count += self.c.check_get_bdevs_methods(uuid_bdev,
|
self.c.resize_lvol_bdev(uuid_bdev, size)
|
||||||
self.total_size / 2)
|
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, size)
|
||||||
|
|
||||||
# size is smaller by 1 MB
|
# size is smaller by 1 MB
|
||||||
self.c.resize_lvol_bdev(uuid_bdev, self.total_size - 1)
|
size = self.total_size - 1
|
||||||
fail_count += self.c.check_get_bdevs_methods(uuid_bdev,
|
self.c.resize_lvol_bdev(uuid_bdev, size)
|
||||||
self.total_size - 1)
|
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, size)
|
||||||
|
|
||||||
# size is equal 0 MiB
|
# size is equal 0 MiB
|
||||||
self.c.resize_lvol_bdev(uuid_bdev, 0)
|
size = 0
|
||||||
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, 0)
|
self.c.resize_lvol_bdev(uuid_bdev, size)
|
||||||
|
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, size)
|
||||||
|
|
||||||
self.c.delete_bdev(uuid_bdev)
|
self.c.delete_bdev(uuid_bdev)
|
||||||
self.c.destroy_lvol_store(uuid_store)
|
self.c.destroy_lvol_store(uuid_store)
|
||||||
@ -525,16 +527,23 @@ class TestCases(object):
|
|||||||
uuid_bdev = self.c.construct_lvol_bdev(uuid_store,
|
uuid_bdev = self.c.construct_lvol_bdev(uuid_store,
|
||||||
self.lbd_name,
|
self.lbd_name,
|
||||||
size)
|
size)
|
||||||
fail_count += self.c.check_get_bdevs_methods(uuid_bdev,
|
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, size)
|
||||||
size)
|
|
||||||
|
|
||||||
# TODO: Improve resize_lvol_bdev tests to verify if bdev was actually
|
sz = size + 1
|
||||||
# correctly resized
|
self.c.resize_lvol_bdev(uuid_bdev, sz)
|
||||||
fail_count += self.c.resize_lvol_bdev(uuid_bdev, size + 1)
|
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, sz)
|
||||||
fail_count += self.c.resize_lvol_bdev(uuid_bdev, size * 2)
|
sz = size * 2
|
||||||
fail_count += self.c.resize_lvol_bdev(uuid_bdev, size * 3)
|
self.c.resize_lvol_bdev(uuid_bdev, sz)
|
||||||
fail_count += self.c.resize_lvol_bdev(uuid_bdev, (size * 4) - 1)
|
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, sz)
|
||||||
fail_count += self.c.resize_lvol_bdev(uuid_bdev, 0)
|
sz = size * 3
|
||||||
|
self.c.resize_lvol_bdev(uuid_bdev, sz)
|
||||||
|
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, sz)
|
||||||
|
sz = (size * 4) - 1
|
||||||
|
self.c.resize_lvol_bdev(uuid_bdev, sz)
|
||||||
|
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, sz)
|
||||||
|
sz = 0
|
||||||
|
self.c.resize_lvol_bdev(uuid_bdev, sz)
|
||||||
|
fail_count += self.c.check_get_bdevs_methods(uuid_bdev, sz)
|
||||||
|
|
||||||
self.c.destroy_lvol_store(uuid_store)
|
self.c.destroy_lvol_store(uuid_store)
|
||||||
if self.c.check_get_lvol_stores("", "", "") == 1:
|
if self.c.check_get_lvol_stores("", "", "") == 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user