test/lvol: rewrite snapshot_during_io_traffic to bash
Change-Id: Ic1081f5426e435d60f465ce0774498928f30d5a0 Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Signed-off-by: Michal Berger <michalx.berger@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/685 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
94435f3876
commit
67609312cf
@ -26,3 +26,20 @@ function round_down() {
|
|||||||
fi
|
fi
|
||||||
echo $(( $1 / CLUSTER_SIZE_MB * CLUSTER_SIZE_MB ))
|
echo $(( $1 / CLUSTER_SIZE_MB * CLUSTER_SIZE_MB ))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function run_fio_test() {
|
||||||
|
local file=$1
|
||||||
|
local offset=$2
|
||||||
|
local size=$3
|
||||||
|
local rw=$4
|
||||||
|
local pattern=$5
|
||||||
|
local extra_params=$6
|
||||||
|
|
||||||
|
local pattern_template="" fio_template=""
|
||||||
|
if [[ -n "$pattern" ]]; then
|
||||||
|
pattern_template="--do_verify=1 --verify=pattern --verify_pattern=$pattern --verify_state_save=0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fio_template="fio --name=fio_test --filename=$file --offset=$offset --size=$size --rw=$rw --direct=1 $extra_params $pattern_template"
|
||||||
|
$fio_template
|
||||||
|
}
|
||||||
|
@ -35,7 +35,6 @@ function usage() {
|
|||||||
653: 'thin_provisioning_resize',
|
653: 'thin_provisioning_resize',
|
||||||
654: 'thin_overprovisioning',
|
654: 'thin_overprovisioning',
|
||||||
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
|
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
|
||||||
752: 'snapshot_during_io_traffic',
|
|
||||||
753: 'snapshot_of_snapshot',
|
753: 'snapshot_of_snapshot',
|
||||||
754: 'clone_bdev_only',
|
754: 'clone_bdev_only',
|
||||||
755: 'clone_writing_clone',
|
755: 'clone_writing_clone',
|
||||||
|
@ -78,6 +78,40 @@ function test_snapshot_compare_with_lvol_bdev() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Check that when writing to lvol bdev
|
||||||
|
# creating snapshot ends with success
|
||||||
|
function test_create_snapshot_with_io() {
|
||||||
|
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 / 2 )) )
|
||||||
|
lvol_size=$(( lvol_size_mb * 1024 * 1024 ))
|
||||||
|
|
||||||
|
lvol_uuid=$(rpc_cmd bdev_lvol_create -u "$lvs_uuid" lvol_test "$lvol_size_mb" -t)
|
||||||
|
|
||||||
|
# Run fio in background that writes to lvol bdev
|
||||||
|
nbd_start_disks "$DEFAULT_RPC_ADDR" "$lvol_uuid" /dev/nbd0
|
||||||
|
run_fio_test /dev/nbd0 0 $lvol_size "write" "0xcc" "--time_based --runtime=16" &
|
||||||
|
fio_proc=$!
|
||||||
|
sleep 4
|
||||||
|
# Create snapshot of lvol bdev
|
||||||
|
snapshot_uuid=$(rpc_cmd bdev_lvol_snapshot lvs_test/lvol_test lvol_snapshot)
|
||||||
|
wait $fio_proc
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
nbd_stop_disks "$DEFAULT_RPC_ADDR" /dev/nbd0
|
||||||
|
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 &
|
$rootdir/app/spdk_tgt/spdk_tgt &
|
||||||
spdk_pid=$!
|
spdk_pid=$!
|
||||||
trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT
|
trap 'killprocess "$spdk_pid"; exit 1' SIGINT SIGTERM EXIT
|
||||||
@ -85,6 +119,7 @@ waitforlisten $spdk_pid
|
|||||||
modprobe nbd
|
modprobe nbd
|
||||||
|
|
||||||
run_test "test_snapshot_compare_with_lvol_bdev" test_snapshot_compare_with_lvol_bdev
|
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
|
||||||
|
|
||||||
trap - SIGINT SIGTERM EXIT
|
trap - SIGINT SIGTERM EXIT
|
||||||
killprocess $spdk_pid
|
killprocess $spdk_pid
|
||||||
|
@ -126,7 +126,6 @@ def case_message(func):
|
|||||||
654: 'thin_overprovisioning',
|
654: 'thin_overprovisioning',
|
||||||
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
|
655: 'thin_provisioning_filling_disks_less_than_lvs_size',
|
||||||
# snapshot and clone
|
# snapshot and clone
|
||||||
752: 'snapshot_during_io_traffic',
|
|
||||||
753: 'snapshot_of_snapshot',
|
753: 'snapshot_of_snapshot',
|
||||||
754: 'clone_bdev_only',
|
754: 'clone_bdev_only',
|
||||||
755: 'clone_writing_clone',
|
755: 'clone_writing_clone',
|
||||||
@ -986,63 +985,6 @@ class TestCases(object):
|
|||||||
# - no other operation fails
|
# - no other operation fails
|
||||||
return fail_count
|
return fail_count
|
||||||
|
|
||||||
@case_message
|
|
||||||
def test_case752(self):
|
|
||||||
"""
|
|
||||||
snapshot_during_io_traffic
|
|
||||||
|
|
||||||
Check that when writing to lvol bdev
|
|
||||||
creating snapshot ends with success
|
|
||||||
"""
|
|
||||||
global current_fio_pid
|
|
||||||
fail_count = 0
|
|
||||||
nbd_name = "/dev/nbd0"
|
|
||||||
snapshot_name = "snapshot"
|
|
||||||
# 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 thin provisioned lvol bdev with size equal to 50% of lvs space
|
|
||||||
size = self.get_lvs_divided_size(2)
|
|
||||||
uuid_bdev = self.c.bdev_lvol_create(uuid_store, self.lbd_name,
|
|
||||||
size, thin=True)
|
|
||||||
|
|
||||||
lvol_bdev = self.c.get_lvol_bdev_with_name(uuid_bdev)
|
|
||||||
fail_count += self.c.nbd_start_disk(lvol_bdev['name'], nbd_name)
|
|
||||||
fill_size = int(size * MEGABYTE)
|
|
||||||
# Create thread that will run fio in background
|
|
||||||
thread = FioThread(nbd_name, 0, fill_size, "write", "0xcc", 0,
|
|
||||||
extra_params="--time_based --runtime=8")
|
|
||||||
# Perform write operation with verification to created lvol bdev
|
|
||||||
thread.start()
|
|
||||||
time.sleep(4)
|
|
||||||
fail_count += is_process_alive(current_fio_pid)
|
|
||||||
# During write operation create snapshot of created lvol bdev
|
|
||||||
# and check that snapshot has been created successfully
|
|
||||||
fail_count += self.c.bdev_lvol_snapshot(lvol_bdev['name'], snapshot_name)
|
|
||||||
fail_count += is_process_alive(current_fio_pid)
|
|
||||||
thread.join()
|
|
||||||
# Check that write operation ended with success
|
|
||||||
fail_count += thread.rv
|
|
||||||
fail_count += self.c.nbd_stop_disk(nbd_name)
|
|
||||||
# Destroy lvol bdev
|
|
||||||
fail_count += self.c.bdev_lvol_delete(lvol_bdev['name'])
|
|
||||||
# Delete snapshot
|
|
||||||
fail_count += self.c.bdev_lvol_delete(self.lvs_name + "/" + snapshot_name)
|
|
||||||
# Destroy lvol store
|
|
||||||
fail_count += self.c.bdev_lvol_delete_lvstore(uuid_store)
|
|
||||||
# Delete malloc bdevs
|
|
||||||
fail_count += self.c.bdev_malloc_delete(base_name)
|
|
||||||
|
|
||||||
# Expected result:
|
|
||||||
# - calls successful, return code = 0
|
|
||||||
# - no other operation fails
|
|
||||||
return fail_count
|
|
||||||
|
|
||||||
@case_message
|
@case_message
|
||||||
def test_case753(self):
|
def test_case753(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user