diff --git a/test/lib/aux.sh b/test/lib/aux.sh index d51a65c58..865314944 100644 --- a/test/lib/aux.sh +++ b/test/lib/aux.sh @@ -354,6 +354,29 @@ prepare_lvmdbusd() { echo ok } +# +# Temporary solution to create some occupied thin metadata +# This heavily depends on thin metadata output format to stay as is. +# Currently it expects 2MB thin metadata and 200MB data volume size +# Argument specifies how many devices should be created. +# +prepare_thin_metadata() { + local devices=$1 + local transaction_id=${2:-0} + local data_block_size=${3:-128} + local nr_data_blocks=${4:-3200} + local i + + echo '' + for i in $(seq 1 $devices) + do + echo ' ' + echo ' ' + echo ' ' + done + echo "" +} + teardown_devs_prefixed() { local prefix=$1 local stray=${2:-0} diff --git a/test/shell/lvextend-thin-full.sh b/test/shell/lvextend-thin-full.sh index cd4705dcf..8fc89a841 100644 --- a/test/shell/lvextend-thin-full.sh +++ b/test/shell/lvextend-thin-full.sh @@ -25,22 +25,6 @@ aux have_thin 1 0 0 || skip test -n "$LVM_TEST_THIN_RESTORE_CMD" || LVM_TEST_THIN_RESTORE_CMD=$(which thin_restore) || skip "$LVM_TEST_THIN_RESTORE_CMD" -V || skip -# -# Temporary solution to create some occupied thin metadata -# This heavily depends on thin metadata output format to stay as is. -# Currently it expects 2MB thin metadata and 200MB data volume size -# Argument specifies how many devices should be created. -fake_metadata_() { - echo '' - for i in $(seq 1 $1) - do - echo ' ' - echo ' ' - echo ' ' - done - echo "" -} - aux have_thin 1 10 0 || skip aux prepare_pvs 3 256 @@ -50,7 +34,7 @@ vgcreate -s 1M $vg $(cat DEVICES) aux lvmconf 'activation/thin_pool_autoextend_percent = 30' \ 'activation/thin_pool_autoextend_threshold = 70' -fake_metadata_ 400 0 >data +aux prepare_thin_metadata 400 0 | tee data lvcreate -L200 -T $vg/pool lvchange -an $vg diff --git a/test/shell/thin-flags.sh b/test/shell/thin-flags.sh index 3fcafb291..395b98d16 100644 --- a/test/shell/thin-flags.sh +++ b/test/shell/thin-flags.sh @@ -16,24 +16,6 @@ SKIP_WITH_LVMPOLLD=1 export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false} - -# TODO - aux/get support for this.... -fake_metadata_() { - echo '' - echo ' ' - echo ' ' - for i in $(seq 10 $1) - do - echo ' ' - echo ' ' - echo ' ' - set +x - done - echo "" - set -x -} - - . lib/inittest # @@ -85,7 +67,7 @@ aux lvmconf 'global/thin_check_executable = ""' # Prepare some fake metadata prefilled to ~100% lvcreate -L2 -n $lv1 $vg # tmp for metadata -fake_metadata_ 500 1 >data +aux prepare_thin_metadata 500 1 | tee data "$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv1" # Swap volume with restored fake metadata