summaryrefslogtreecommitdiff
path: root/test/shell/lvconvert-raid-reshape-striped_to_linear.sh
diff options
context:
space:
mode:
authorHeinz Mauelshagen <heinzm@redhat.com>2017-02-24 05:16:21 +0100
committerHeinz Mauelshagen <heinzm@redhat.com>2017-02-24 05:20:59 +0100
commit76f60cc4306deda481c45de7ebcde02a40668d85 (patch)
tree06be0988606345c12c01ba70549e6c850787804a /test/shell/lvconvert-raid-reshape-striped_to_linear.sh
parent2574d3257ad41cad8dcbad3332774172e86f05da (diff)
downloadlvm2-76f60cc4306deda481c45de7ebcde02a40668d85.tar.gz
lvconvert: add missed new test scripts for reshaping
Add aforementioned but forgotten new test scripts lvconvert-raid-reshape-linear_to_striped.sh, lvconvert-raid-reshape-striped_to_linear.sh and lvconvert-raid-reshape.sh Those presume dm-raid target version 1.10.2 provided by a following kernel patch. Related: rhbz834579 Related: rhbz1191935 Related: rhbz1191978
Diffstat (limited to 'test/shell/lvconvert-raid-reshape-striped_to_linear.sh')
-rw-r--r--test/shell/lvconvert-raid-reshape-striped_to_linear.sh84
1 files changed, 84 insertions, 0 deletions
diff --git a/test/shell/lvconvert-raid-reshape-striped_to_linear.sh b/test/shell/lvconvert-raid-reshape-striped_to_linear.sh
new file mode 100644
index 000000000..fc87cafb8
--- /dev/null
+++ b/test/shell/lvconvert-raid-reshape-striped_to_linear.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+# Copyright (C) 2017 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, MA2110-1301 USA
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+. lib/inittest
+
+which mkfs.ext4 || skip
+aux have_raid 1 10 2 || skip
+
+aux prepare_vg 5
+
+#
+# Test single step linear -> striped conversion
+#
+
+# Create 4-way striped LV
+lvcreate -aey -i 4 -I 32k -L 16M -n $lv1 $vg
+check lv_field $vg/$lv1 segtype "striped"
+check lv_field $vg/$lv1 stripes 4
+check lv_field $vg/$lv1 stripesize "32.00k"
+echo y|mkfs -t ext4 $DM_DEV_DIR/$vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert striped -> raid5(_n)
+lvconvert -y --ty raid5 -R 128k $vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+check lv_field $vg/$lv1 segtype "raid5_n"
+check lv_field $vg/$lv1 stripes 5
+check lv_field $vg/$lv1 stripesize "32.00k"
+check lv_field $vg/$lv1 regionsize "128.00k"
+aux wait_for_sync $vg $lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Extend raid5_n LV by factor 4 to keep size once linear
+lvresize -y -L 64 $vg/$lv1
+aux wait_for_sync $vg $lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Convert raid5_n LV to 1 stripe (2 legs total),
+# 64k stripesize and 1024k regionsize
+# FIXME: "--type" superfluous (cli fix needed)
+lvconvert -y -f --ty raid5_n --stripes 1 -I 64k -R 1024k $vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+check lv_first_seg_field $vg/$lv1 segtype "raid5_n"
+check lv_first_seg_field $vg/$lv1 stripes 5
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 regionsize "1.00m"
+aux wait_for_sync $vg $lv1 1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+
+# Remove the now freed legs
+lvconvert --stripes 1 $vg/$lv1
+check lv_first_seg_field $vg/$lv1 segtype "raid5_n"
+check lv_first_seg_field $vg/$lv1 stripes 2
+check lv_first_seg_field $vg/$lv1 stripesize "64.00k"
+check lv_first_seg_field $vg/$lv1 regionsize "1.00m"
+
+# Convert raid5_n to raid1
+lvconvert -y --type raid1 $vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+check lv_first_seg_field $vg/$lv1 segtype "raid1"
+check lv_first_seg_field $vg/$lv1 stripes 2
+check lv_first_seg_field $vg/$lv1 stripesize "0"
+check lv_first_seg_field $vg/$lv1 regionsize "1.00m"
+
+# Convert raid5_n -> striped
+lvconvert -y --type linear $vg/$lv1
+fsck -fn $DM_DEV_DIR/$vg/$lv1
+check lv_first_seg_field $vg/$lv1 segtype "linear"
+check lv_first_seg_field $vg/$lv1 stripes 1
+check lv_first_seg_field $vg/$lv1 stripesize "0"
+check lv_first_seg_field $vg/$lv1 regionsize "0"
+
+vgremove -ff $vg