test/lvol: rewrite snapshot_of_snapshot to bash
Change-Id: Ia3a2807276ebd7b4d9b16bb533f23f3683d7b08c Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/686 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Michal Berger <michalx.berger@intel.com>
This commit is contained in:
parent
67609312cf
commit
9010c464da
@ -35,7 +35,6 @@ function usage() {
|
||||
653: 'thin_provisioning_resize',
|
||||
654: 'thin_overprovisioning',
|
||||
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
|
||||
753: 'snapshot_of_snapshot',
|
||||
754: 'clone_bdev_only',
|
||||
755: 'clone_writing_clone',
|
||||
756: 'clone_and_snapshot_consistency',
|
||||
|
@ -112,6 +112,35 @@ function test_create_snapshot_with_io() {
|
||||
}
|
||||
|
||||
|
||||
# Check that creating snapshot of snapshot will fail
|
||||
function test_create_snapshot_of_snapshot() {
|
||||
malloc_name=$(rpc_cmd bdev_malloc_create $MALLOC_SIZE_MB $MALLOC_BS)
|
||||
lvs_uuid=$(rpc_cmd bdev_lvol_create_lvstore "$malloc_name" lvs_test)
|
||||
|
||||
# Create lvol bdev
|
||||
lvol_size_mb=$( round_down $(( LVS_DEFAULT_CAPACITY_MB / 3 )) )
|
||||
|
||||
lvol_uuid=$(rpc_cmd bdev_lvol_create -u "$lvs_uuid" lvol_test "$lvol_size_mb")
|
||||
lvol=$(rpc_cmd bdev_get_bdevs -b "$lvol_uuid")
|
||||
|
||||
# Create snapshots of lvol bdev
|
||||
snapshot_uuid=$(rpc_cmd bdev_lvol_snapshot lvs_test/lvol_test lvol_snapshot)
|
||||
|
||||
# Create snapshot of previously created snapshot
|
||||
# and check if operation will fail
|
||||
rpc_cmd bdev_lvol_snapshot lvs_test/lvol_snapshot lvol_snapshot2 && false
|
||||
|
||||
# Clean up
|
||||
rpc_cmd bdev_lvol_delete "$lvol_uuid"
|
||||
rpc_cmd bdev_get_bdevs -b "$lvol_uuid" && false
|
||||
rpc_cmd bdev_lvol_delete "$snapshot_uuid"
|
||||
rpc_cmd bdev_get_bdevs -b "$snapshot_uuid" && false
|
||||
rpc_cmd bdev_lvol_delete_lvstore -u "$lvs_uuid"
|
||||
rpc_cmd bdev_lvol_get_lvstores -u "$lvs_uuid" && false
|
||||
rpc_cmd bdev_malloc_delete "$malloc_name"
|
||||
check_leftover_devices
|
||||
}
|
||||
|
||||
$rootdir/app/spdk_tgt/spdk_tgt &
|
||||
spdk_pid=$!
|
||||
trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT
|
||||
@ -120,6 +149,7 @@ modprobe nbd
|
||||
|
||||
run_test "test_snapshot_compare_with_lvol_bdev" test_snapshot_compare_with_lvol_bdev
|
||||
run_test "test_create_snapshot_with_io" test_create_snapshot_with_io
|
||||
run_test "test_create_snapshot_of_snapshot" test_create_snapshot_of_snapshot
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
killprocess $spdk_pid
|
||||
|
@ -126,7 +126,6 @@ def case_message(func):
|
||||
654: 'thin_overprovisioning',
|
||||
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
|
||||
# snapshot and clone
|
||||
753: 'snapshot_of_snapshot',
|
||||
754: 'clone_bdev_only',
|
||||
755: 'clone_writing_clone',
|
||||
756: 'clone_and_snapshot_consistency',
|
||||
@ -985,52 +984,6 @@ class TestCases(object):
|
||||
# - no other operation fails
|
||||
return fail_count
|
||||
|
||||
@case_message
|
||||
def test_case753(self):
|
||||
"""
|
||||
snapshot_of_snapshot
|
||||
|
||||
Check that creating snapshot of snapshot will fail
|
||||
"""
|
||||
fail_count = 0
|
||||
snapshot_name0 = "snapshot0"
|
||||
snapshot_name1 = "snapshot1"
|
||||
# Create malloc bdev
|
||||
base_name = self.c.bdev_malloc_create(self.total_size,
|
||||
self.block_size)
|
||||
# Construct lvol store
|
||||
uuid_store = self.c.bdev_lvol_create_lvstore(base_name,
|
||||
self.lvs_name)
|
||||
fail_count += self.c.check_bdev_lvol_get_lvstores(base_name, uuid_store,
|
||||
self.cluster_size)
|
||||
# Create thick provisioned lvol bdev
|
||||
size = self.get_lvs_divided_size(2)
|
||||
uuid_bdev = self.c.bdev_lvol_create(uuid_store, self.lbd_name,
|
||||
size, thin=False)
|
||||
|
||||
lvol_bdev = self.c.get_lvol_bdev_with_name(uuid_bdev)
|
||||
# Create snapshot of created lvol bdev
|
||||
fail_count += self.c.bdev_lvol_snapshot(lvol_bdev['name'], snapshot_name0)
|
||||
# Create snapshot of previously created snapshot
|
||||
# and check if operation will fail
|
||||
if self.c.bdev_lvol_snapshot(snapshot_name0, snapshot_name1) == 0:
|
||||
print("ERROR: Creating snapshot of snapshot should fail")
|
||||
fail_count += 1
|
||||
# Delete lvol bdev
|
||||
fail_count += self.c.bdev_lvol_delete(lvol_bdev['name'])
|
||||
# Destroy snapshot
|
||||
fail_count += self.c.bdev_lvol_delete(self.lvs_name + "/" + snapshot_name0)
|
||||
# Destroy lvol store
|
||||
fail_count += self.c.bdev_lvol_delete_lvstore(uuid_store)
|
||||
# Delete malloc bdev
|
||||
fail_count += self.c.bdev_malloc_delete(base_name)
|
||||
|
||||
# Expected result:
|
||||
# - calls successful, return code = 0
|
||||
# - creating snapshot of snapshot should fail
|
||||
# - no other operation fails
|
||||
return fail_count
|
||||
|
||||
@case_message
|
||||
def test_case754(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user