2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2017-02-24 07:16:21 +03:00
# 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
2017-06-23 15:52:34 +03:00
aux have_raid 1 12 0 || skip
2017-02-24 07:16:21 +03:00
2017-04-20 22:05:07 +03:00
# Temporarily skip reshape tests on single-core CPUs until there's a fix for
# https://bugzilla.redhat.com/1443999 - AGK 2017/04/20
2017-04-21 02:21:24 +03:00
aux have_multi_core || skip
2017-02-24 07:16:21 +03:00
aux prepare_vg 5
#
# Test single step linear -> striped conversion
#
# Create linear LV
lvcreate -aey -L 16M -n $lv1 $vg
check lv_field $vg /$lv1 segtype "linear"
check lv_field $vg /$lv1 stripes 1
2017-03-01 20:50:35 +03:00
check lv_field $vg /$lv1 data_stripes 1
2017-02-24 07:16:21 +03:00
echo y| mkfs -t ext4 $DM_DEV_DIR /$vg /$lv1
fsck -fn $DM_DEV_DIR /$vg /$lv1
# Convert linear -> raid1
lvconvert -y -m 1 $vg /$lv1
fsck -fn $DM_DEV_DIR /$vg /$lv1
check lv_field $vg /$lv1 segtype "raid1"
check lv_field $vg /$lv1 stripes 2
2017-03-01 20:50:35 +03:00
check lv_field $vg /$lv1 data_stripes 2
2017-02-24 07:16:21 +03:00
check lv_field $vg /$lv1 regionsize "512.00k"
aux wait_for_sync $vg $lv1
fsck -fn $DM_DEV_DIR /$vg /$lv1
# Convert raid1 -> raid5_n
2017-04-22 01:42:09 +03:00
lvconvert -y --ty raid5_n --stripesize 64K --regionsize 512K $vg /$lv1
2017-02-24 07:16:21 +03:00
fsck -fn $DM_DEV_DIR /$vg /$lv1
check lv_field $vg /$lv1 segtype "raid5_n"
check lv_field $vg /$lv1 stripes 2
2017-03-01 20:50:35 +03:00
check lv_field $vg /$lv1 data_stripes 1
2017-02-24 07:16:21 +03:00
check lv_field $vg /$lv1 stripesize "64.00k"
check lv_field $vg /$lv1 regionsize "512.00k"
# Convert raid5_n adding stripes
lvconvert -y --stripes 4 $vg /$lv1
fsck -fn $DM_DEV_DIR /$vg /$lv1
check lv_first_seg_field $vg /$lv1 segtype "raid5_n"
2017-03-01 20:50:35 +03:00
check lv_first_seg_field $vg /$lv1 data_stripes 4
2017-02-24 07:16:21 +03:00
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 "512.00k"
2017-03-16 23:17:58 +03:00
check lv_first_seg_field $vg /$lv1 reshape_len_le 10
2017-02-24 07:16:21 +03:00
aux wait_for_sync $vg $lv1
fsck -fn $DM_DEV_DIR /$vg /$lv1
# Convert raid5_n -> striped
lvconvert -y --type striped $vg /$lv1
fsck -fn $DM_DEV_DIR /$vg /$lv1
vgremove -ff $vg