mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
tests: aux prepare_thin_metadata
This commit is contained in:
parent
83d483269d
commit
a67a5d4655
@ -354,6 +354,29 @@ prepare_lvmdbusd() {
|
|||||||
echo ok
|
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 '<superblock uuid="" time="1" transaction="'$transaction_id'" data_block_size="'$data_block_size'" nr_data_blocks="'$nr_data_blocks'">'
|
||||||
|
for i in $(seq 1 $devices)
|
||||||
|
do
|
||||||
|
echo ' <device dev_id="'$i'" mapped_blocks="37" transaction="'$i'" creation_time="0" snap_time="1">'
|
||||||
|
echo ' <range_mapping origin_begin="0" data_begin="0" length="37" time="0"/>'
|
||||||
|
echo ' </device>'
|
||||||
|
done
|
||||||
|
echo "</superblock>"
|
||||||
|
}
|
||||||
|
|
||||||
teardown_devs_prefixed() {
|
teardown_devs_prefixed() {
|
||||||
local prefix=$1
|
local prefix=$1
|
||||||
local stray=${2:-0}
|
local stray=${2:-0}
|
||||||
|
@ -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
|
test -n "$LVM_TEST_THIN_RESTORE_CMD" || LVM_TEST_THIN_RESTORE_CMD=$(which thin_restore) || skip
|
||||||
"$LVM_TEST_THIN_RESTORE_CMD" -V || 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 '<superblock uuid="" time="1" transaction="'$2'" data_block_size="128" nr_data_blocks="3200">'
|
|
||||||
for i in $(seq 1 $1)
|
|
||||||
do
|
|
||||||
echo ' <device dev_id="'$i'" mapped_blocks="37" transaction="0" creation_time="0" snap_time="1">'
|
|
||||||
echo ' <range_mapping origin_begin="0" data_begin="0" length="37" time="0"/>'
|
|
||||||
echo ' </device>'
|
|
||||||
done
|
|
||||||
echo "</superblock>"
|
|
||||||
}
|
|
||||||
|
|
||||||
aux have_thin 1 10 0 || skip
|
aux have_thin 1 10 0 || skip
|
||||||
|
|
||||||
aux prepare_pvs 3 256
|
aux prepare_pvs 3 256
|
||||||
@ -50,7 +34,7 @@ vgcreate -s 1M $vg $(cat DEVICES)
|
|||||||
aux lvmconf 'activation/thin_pool_autoextend_percent = 30' \
|
aux lvmconf 'activation/thin_pool_autoextend_percent = 30' \
|
||||||
'activation/thin_pool_autoextend_threshold = 70'
|
'activation/thin_pool_autoextend_threshold = 70'
|
||||||
|
|
||||||
fake_metadata_ 400 0 >data
|
aux prepare_thin_metadata 400 0 | tee data
|
||||||
lvcreate -L200 -T $vg/pool
|
lvcreate -L200 -T $vg/pool
|
||||||
lvchange -an $vg
|
lvchange -an $vg
|
||||||
|
|
||||||
|
@ -16,24 +16,6 @@ SKIP_WITH_LVMPOLLD=1
|
|||||||
|
|
||||||
export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
|
export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
|
||||||
|
|
||||||
|
|
||||||
# TODO - aux/get support for this....
|
|
||||||
fake_metadata_() {
|
|
||||||
echo '<superblock uuid="" time="0" transaction="'$2'" data_block_size="128" nr_data_blocks="3200">'
|
|
||||||
echo ' <device dev_id="1" mapped_blocks="0" transaction="0" creation_time="0" snap_time="0">'
|
|
||||||
echo ' </device>'
|
|
||||||
for i in $(seq 10 $1)
|
|
||||||
do
|
|
||||||
echo ' <device dev_id="'$i'" mapped_blocks="30" transaction="0" creation_time="0" snap_time="0">'
|
|
||||||
echo ' <range_mapping origin_begin="0" data_begin="0" length="29" time="0"/>'
|
|
||||||
echo ' </device>'
|
|
||||||
set +x
|
|
||||||
done
|
|
||||||
echo "</superblock>"
|
|
||||||
set -x
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
. lib/inittest
|
. lib/inittest
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -85,7 +67,7 @@ aux lvmconf 'global/thin_check_executable = ""'
|
|||||||
|
|
||||||
# Prepare some fake metadata prefilled to ~100%
|
# Prepare some fake metadata prefilled to ~100%
|
||||||
lvcreate -L2 -n $lv1 $vg # tmp for metadata
|
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"
|
"$LVM_TEST_THIN_RESTORE_CMD" -i data -o "$DM_DEV_DIR/mapper/$vg-$lv1"
|
||||||
|
|
||||||
# Swap volume with restored fake metadata
|
# Swap volume with restored fake metadata
|
||||||
|
Loading…
x
Reference in New Issue
Block a user