Skip to content

Commit

Permalink
test/lvol: Test cases for lvs thin provisioning.
Browse files Browse the repository at this point in the history
Change-Id: I019125ee634edf79d2ed6d159fbdad605061377c
Signed-off-by: Pawel Kaminski <[email protected]>
Signed-off-by: Tomasz Zawadzki <[email protected]>
Signed-off-by: Karol Latecki <[email protected]>
Signed-off-by: Pawel Kaminski <[email protected]>
Reviewed-on: https://review.gerrithub.io/391492
Tested-by: SPDK Automated Test System <[email protected]>
Reviewed-by: Maciej Szwed <[email protected]>
Reviewed-by: Jim Harris <[email protected]>
  • Loading branch information
tomzawadzki authored and jimharris committed Feb 8, 2018
1 parent 628cd5e commit d13c94b
Show file tree
Hide file tree
Showing 4 changed files with 310 additions and 19 deletions.
3 changes: 2 additions & 1 deletion autotest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ fi
if [ $SPDK_TEST_LVOL -eq 1 ]; then
timing_enter lvol
test_cases="1,50,51,52,53,100,101,102,250,251,252,253,255,"
test_cases+="300,301,450,451,452,550,600,601,650,651,700"
test_cases+="300,301,450,451,452,550,600,601,650,651,652,654,655,"
test_cases+="700,701,750"
run_test ./test/lvol/lvol.sh --test-cases=$test_cases
timing_exit lvol
fi
Expand Down
14 changes: 11 additions & 3 deletions test/lvol/lvol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@ function usage() {
550: 'delete_bdev_positive',
600: 'construct_lvol_store_with_cluster_size_max',
601 'construct_lvol_store_with_cluster_size_min',
650: 'tasting_positive',
651: 'tasting_lvol_store_positive',
700: 'SIGTERM'
650: 'thin_provisioning_check_space',
651: 'thin_provisioning_read_empty_bdev',
652: 'thin_provisionind_data_integrity_test',
653: 'thin_provisioning_resize',
654: 'thin_overprovisioning',
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
700: 'tasting_positive',
701: 'tasting_lvol_store_positive',
750: 'SIGTERM'
or
all: This parameter runs all tests
Ex: \"1,2,19,20\", default: all"
Expand Down Expand Up @@ -85,6 +91,7 @@ source $TEST_DIR/scripts/autotest_common.sh
### Function starts vhost app
function vhost_start()
{
modprobe nbd
touch $BASE_DIR/vhost.conf
$TEST_DIR/scripts/gen_nvme.sh >> $BASE_DIR/vhost.conf
$TEST_DIR/app/vhost/vhost -c $BASE_DIR/vhost.conf &
Expand All @@ -102,6 +109,7 @@ function vhost_kill()
fi
rm $BASE_DIR/vhost.pid || true
rm $BASE_DIR/vhost.conf || true
rmmod nbd || true
}

trap "vhost_kill; exit 1" SIGINT SIGTERM EXIT
Expand Down
32 changes: 28 additions & 4 deletions test/lvol/rpc_commands_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,17 @@ def construct_lvol_store(self, base_name, lvs_name, cluster_size):
"-c {cluster_sz}".format(cluster_sz=cluster_size))[0]
return output.rstrip('\n')

def construct_lvol_bdev(self, uuid, lbd_name, size):
def construct_lvol_bdev(self, uuid, lbd_name, size, thin=False):
print("INFO: RPC COMMAND construct_lvol_bdev")
try:
uuid_obj = UUID(uuid)
name_opt = "-u"
except ValueError:
name_opt = "-l"
output = self.rpc.construct_lvol_bdev(name_opt, uuid, lbd_name, size)[0]
thin_provisioned = ""
if thin:
thin_provisioned = "-t"
output = self.rpc.construct_lvol_bdev(name_opt, uuid, lbd_name, size, thin_provisioned)[0]
return output.rstrip('\n')

def destroy_lvol_store(self, uuid):
Expand All @@ -131,9 +134,22 @@ def resize_lvol_bdev(self, uuid, new_size):
output, rc = self.rpc.resize_lvol_bdev(uuid, new_size)
return rc

def get_lvol_stores(self):
def start_nbd_disk(self, bdev_name, nbd_name):
print("INFO: RPC COMMAND start_nbd_disk")
output, rc = self.rpc.start_nbd_disk(bdev_name, nbd_name)
return rc

def stop_nbd_disk(self, nbd_name):
print("INFO: RPC COMMAND stop_nbd_disk")
output, rc = self.rpc.stop_nbd_disk(nbd_name)
return rc

def get_lvol_stores(self, name=None):
print("INFO: RPC COMMAND get_lvol_stores")
output = json.loads(self.rpc.get_lvol_stores()[0])
if name:
output = json.loads(self.rpc.get_lvol_stores("-l", name)[0])
else:
output = json.loads(self.rpc.get_lvol_stores()[0])
return output

def get_lvol_bdevs(self):
Expand All @@ -145,6 +161,14 @@ def get_lvol_bdevs(self):
output.append(bdev)
return output

def get_lvol_bdev_with_name(self, name):
print("INFO: RPC COMMAND get_bdevs; lvol bdevs only")
rpc_output = json.loads(self.rpc.get_bdevs("-b", name)[0])
if len(rpc_output) > 0:
return rpc_output[0]

return None

def construct_nvme_bdev(self, nvme_name, trtype, traddr):
print("INFO: Add NVMe bdev {nvme}".format(nvme=nvme_name))
self.rpc.construct_nvme_bdev("-b", nvme_name, "-t", trtype, "-a", traddr)
Loading

0 comments on commit d13c94b

Please sign in to comment.