From 935813457ff86e959920879fd8fba5ff9be1e2a6 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 3 Jul 2023 20:50:49 +0200 Subject: [PATCH] tests: update thin --- test/shell/lvconvert-thin-from-thick.sh | 84 +++++++++++++++++++++++++ test/shell/lvconvert-thin.sh | 2 +- 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 test/shell/lvconvert-thin-from-thick.sh diff --git a/test/shell/lvconvert-thin-from-thick.sh b/test/shell/lvconvert-thin-from-thick.sh new file mode 100644 index 000000000..09283b195 --- /dev/null +++ b/test/shell/lvconvert-thin-from-thick.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash + +# Copyright (C) 2023 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions +# of the GNU General Public License v.2. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +# Test conversion to thin volume from thick LVs + +SKIP_WITH_LVMLOCKD=1 +SKIP_WITH_LVMPOLLD=1 + +export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false} + +. lib/inittest + +which mkfs.ext4 || skip +which fsck || skip +which thin_restore || skip +aux have_thin 1 5 0 || skip + +_convert_to_thin() { + mkfs.ext4 -E nodiscard "$DM_DEV_DIR/$vg/$lv1" + lvconvert --yes --type thin $vg/$lv1 + fsck -n "$DM_DEV_DIR/$vg/$lv1" + check lv_field $vg/$lv1 segtype thin + lvs -ao+segtype $vg + lvremove -f $vg +} + + +# +# Main +# +aux prepare_vg 2 6000 + +# error -> thin +lvcreate --type error -Zn -L10 -n $lv1 $vg +lvconvert --yes --type thin $vg/$lv1 +not dd if="$DM_DEV_DIR/$vg/$lv1" of=/dev/null bs=512 count=1 +lvremove -f $vg + +# zero -> thin +lvcreate --type zero -L2T -n $lv1 $vg +lvconvert --yes --type thin $vg/$lv1 +lvremove -f $vg + +# linear -> thin +lvcreate -L10 -n $lv1 $vg +_convert_to_thin + +# raid1 -> thin +if aux have_raid 1 7 0 ; then + lvcreate --type raid1 -L10 -n $lv1 $vg + _convert_to_thin +fi + +# cache -> thin +if aux have_cache 1 3 0 ; then + lvcreate -L10 -n $lv1 $vg + lvcreate -H -L10 $vg/$lv1 + _convert_to_thin +fi + +# writecache -> thin +if aux have_cache 1 3 0 ; then + lvcreate -L10 -n $lv1 $vg + lvcreate -an -L10 -n $lv2 $vg + lvconvert --yes --type writecache --cachevol $lv2 $vg/$lv1 + _convert_to_thin +fi + +# vdo -> thin +if aux have_vdo 6 2 0 ; then + lvcreate --type vdo -L4G -n $lv1 $vg/$lv2 + _convert_to_thin +fi + +vgremove -ff $vg diff --git a/test/shell/lvconvert-thin.sh b/test/shell/lvconvert-thin.sh index bfda8e50d..b1b11abe9 100644 --- a/test/shell/lvconvert-thin.sh +++ b/test/shell/lvconvert-thin.sh @@ -45,7 +45,7 @@ pvcreate "$DM_DEV_DIR/$vg1/$lv" vgcreate $vg -s 64K "$dev4" "$DM_DEV_DIR/$vg1/$lv" lvcreate -L1T -n $lv1 $vg -invalid lvconvert --yes -c 8M --type thin --poolmetadatasize 1G $vg/$lv1 +lvconvert --yes -c 8M --type thin --poolmetadatasize 1G $vg/$lv1 # needs some --cachepool or --thinpool invalid lvconvert --yes --poolmetadatasize 1G $vg/$lv1