summaryrefslogtreecommitdiff
path: root/test/shell/lvconvert-raid-takeover-thin.sh
blob: 8bea24495d961b0799db11c16fafe64b8c9bad5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash

# 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

# check we may convert thin-pool to raid1/raid10 and back
# RHBZ#1365286


SKIP_WITH_LVMPOLLD=1

. lib/inittest

aux have_thin 1 0 0 || skip
aux have_raid 1 9 0 || skip

aux prepare_vg 6

lvcreate -L4 -i3 -T $vg/pool -V10

for i in 1 2 ; do
lvconvert --type raid10 -y $vg/pool_tdata
check grep_dmsetup table $vg-pool_tdata "raid10"
aux wait_for_sync $vg pool_tdata

lvconvert --type striped -y $vg/pool_tdata
check grep_dmsetup table $vg-pool_tdata "striped"
done

lvremove -f $vg

lvcreate -L4  -T $vg/pool -V10 -n $lv1

for j in data meta ; do
  LV=pool_t${j}
  for i in 1 2 ; do
    lvconvert --type raid1 -m1 -y  $vg/$LV
    check grep_dmsetup table $vg-${LV} "raid1"
    aux wait_for_sync $vg $LV

    lvconvert --type raid1 -m0 -y  $vg/$LV
    check grep_dmsetup table ${vg}-${LV} "linear"
  done
done


#
# Now same test again, when lock holding LV is not a thin-poll
# but thinLV $lv1
#
lvchange -an $vg
lvchange -ay $vg/$lv1

for j in data meta ; do
  LV=pool_t${j}
  for i in 1 2 ; do
    lvconvert --type raid1 -m1 -y  $vg/$LV
    check grep_dmsetup table $vg-${LV} "raid1"
    aux wait_for_sync $vg $LV

    lvconvert --type raid1 -m0 -y  $vg/$LV
    check grep_dmsetup table ${vg}-${LV} "linear"
  done
done

vgremove -ff $vg