test/lvol: Fix test cases for lvol store cluster size
rpc_commands_lib.py: make cluster size optional argument as sometimes we only need to check if lvol store exists and not care about details. Test cases 600 and 601 fix: add missing delete_bdev() at the end, add using get_lvol_stores to check if lvol store was created. Test case 601 modified: Change test case to check if creating a lvol store with cluster size less than 8192 is disallowed. Previous check for cluster size of 0 was incorrect as 0 is an allowed value for that operation and results in setting default cluster size. Change-Id: I8bcbed9a7dff3e81fcc0ca4b525da3a1d0627495 Signed-off-by: Karol Latecki <karol.latecki@intel.com> Reviewed-on: https://review.gerrithub.io/398370 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
6336217e16
commit
5d2881c6dd
@ -52,31 +52,36 @@ class Commands_Rpc(object):
|
|||||||
json_value=json_value))
|
json_value=json_value))
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
def check_get_lvol_stores(self, base_name, uuid, cluster_size):
|
def check_get_lvol_stores(self, base_name, uuid, cluster_size=None):
|
||||||
print("INFO: RPC COMMAND get_lvol_stores")
|
print("INFO: RPC COMMAND get_lvol_stores")
|
||||||
json_value = self.get_lvol_stores()
|
json_value = self.get_lvol_stores()
|
||||||
if json_value:
|
if json_value:
|
||||||
for i in range(len(json_value)):
|
for i in range(len(json_value)):
|
||||||
uuid_json_response = json_value[i]['uuid']
|
json_uuid = json_value[i]['uuid']
|
||||||
cluster_size_response = json_value[i]['cluster_size']
|
json_cluster = json_value[i]['cluster_size']
|
||||||
base_bdev_json_reponse = json_value[i]['base_bdev']
|
json_base_name = json_value[i]['base_bdev']
|
||||||
if base_name in [base_bdev_json_reponse] \
|
|
||||||
and uuid in [uuid_json_response] \
|
if base_name in json_base_name \
|
||||||
and cluster_size in [cluster_size_response]:
|
and uuid in json_uuid:
|
||||||
print("INFO: base_name:{base_name} is found in RPC "
|
print("INFO: base_name:{base_name} is found in RPC "
|
||||||
"Command: get_lvol_stores "
|
"Command: get_lvol_stores "
|
||||||
"response".format(base_name=base_name))
|
"response".format(base_name=base_name))
|
||||||
print("INFO: UUID:{uuid} is found in RPC Command: "
|
print("INFO: UUID:{uuid} is found in RPC Command: "
|
||||||
"get_lvol_stores response".format(uuid=uuid))
|
"get_lvol_stores response".format(uuid=uuid))
|
||||||
print("INFO: Cluster size :{cluster_size} is found in RPC "
|
if cluster_size:
|
||||||
"Commnad: get_lvol_stores "
|
if str(cluster_size) in str(json_cluster):
|
||||||
"response".format(cluster_size=cluster_size))
|
print("Info: Cluster size :{cluster_size} is found in RPC "
|
||||||
|
"Command: get_lvol_stores "
|
||||||
|
"response".format(cluster_size=cluster_size))
|
||||||
|
else:
|
||||||
|
print("ERROR: Wrong cluster size in lvol store")
|
||||||
|
print("Expected:".format(cluster_size))
|
||||||
|
print("Actual:".format(json_cluster))
|
||||||
|
return 1
|
||||||
return 0
|
return 0
|
||||||
print("FAILED: UUID: {uuid} or base_name: {base_name} or "
|
print("FAILED: UUID: lvol store {uuid} on base_bdev: "
|
||||||
"cluster size: {cluster_size} not found in RPC COMMAND "
|
"{base_name} not found in get_lvol_stores()".format(uuid=uuid,
|
||||||
"get_bdevs: {json_value}".format(uuid=uuid,
|
base_name=base_name))
|
||||||
base_name=base_name,
|
|
||||||
json_value=json_value))
|
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
print("INFO: Lvol store not exist")
|
print("INFO: Lvol store not exist")
|
||||||
|
@ -656,22 +656,24 @@ class TestCases(object):
|
|||||||
fail_count = 0
|
fail_count = 0
|
||||||
base_name = self.c.construct_malloc_bdev(self.total_size,
|
base_name = self.c.construct_malloc_bdev(self.total_size,
|
||||||
self.block_size)
|
self.block_size)
|
||||||
if self.c.construct_lvol_store(base_name,
|
lvol_uuid = self.c.construct_lvol_store(base_name,
|
||||||
self.lvs_name,
|
self.lvs_name,
|
||||||
(self.total_size * 1024 * 1024) + 1) == 0:
|
(self.total_size * 1024 * 1024) + 1) == 0
|
||||||
|
if self.c.check_get_lvol_stores(base_name, lvol_uuid) == 0:
|
||||||
fail_count += 1
|
fail_count += 1
|
||||||
|
fail_count += self.c.delete_bdev(base_name)
|
||||||
footer(600)
|
footer(600)
|
||||||
return fail_count
|
return fail_count
|
||||||
|
|
||||||
def test_case601(self):
|
def test_case601(self):
|
||||||
header(601)
|
header(601)
|
||||||
fail_count = 0
|
fail_count = 0
|
||||||
# Create malloc bdev smaller than default lvol cluster size
|
base_name = self.c.construct_malloc_bdev(self.total_size,
|
||||||
base_name = self.c.construct_malloc_bdev(1,
|
|
||||||
self.block_size)
|
self.block_size)
|
||||||
if self.c.construct_lvol_store(base_name,
|
lvol_uuid = self.c.construct_lvol_store(base_name, self.lvs_name, 8191)
|
||||||
self.lvs_name, 0) == 0:
|
if self.c.check_get_lvol_stores(base_name, lvol_uuid) == 0:
|
||||||
fail_count += 1
|
fail_count += 1
|
||||||
|
fail_count += self.c.delete_bdev(base_name)
|
||||||
footer(601)
|
footer(601)
|
||||||
return fail_count
|
return fail_count
|
||||||
|
|
||||||
|
@ -544,13 +544,14 @@ Expected result:
|
|||||||
|
|
||||||
#### TEST CASE 601 - Name: construct_lvol_store_with_cluster_size_min
|
#### TEST CASE 601 - Name: construct_lvol_store_with_cluster_size_min
|
||||||
Negative test for constructing a new lvol store.
|
Negative test for constructing a new lvol store.
|
||||||
Call construct_lvol_store with cluster size = 0.
|
Call construct_lvol_store with cluster size smaller than minimal value of 8192.
|
||||||
Steps:
|
Steps:
|
||||||
- create a malloc bdev
|
- create a malloc bdev
|
||||||
- construct_lvol_store on correct, exisitng malloc bdev and cluster size 0
|
- try construct lvol store on malloc bdev with cluster size 8191
|
||||||
|
- verify that lvol store was not created
|
||||||
|
|
||||||
Expected result:
|
Expected result:
|
||||||
- return code != 0
|
- construct lvol store return code != 0
|
||||||
- Error code response printed to stdout
|
- Error code response printed to stdout
|
||||||
|
|
||||||
### Provisioning
|
### Provisioning
|
||||||
|
Loading…
Reference in New Issue
Block a user