diff options
author | Heinz Mauelshagen <heinzm@redhat.com> | 2016-10-21 18:59:59 +0200 |
---|---|---|
committer | Heinz Mauelshagen <heinzm@redhat.com> | 2016-10-21 19:00:31 +0200 |
commit | de78e8eae73cb155fdb906ef2b8ddc9ca1a918c4 (patch) | |
tree | 5742fc496df009b5d7d2fe74251dacd7f76d3ee7 /test/shell/lvconvert-raid-takeover.sh | |
parent | 34da83d729436d245e91e24e30b6996862fe7725 (diff) | |
download | lvm2-de78e8eae73cb155fdb906ef2b8ddc9ca1a918c4.tar.gz |
lvconvert: position dedicated parity device in raid4 conversions porperly
On conversions between striped/raid0* and raid4, the kernel expects
the dedicated raid4 parity SubLVs in the first segment area rather than
in the last it's been allocated to, thus the data mapping ain't proper.
Enhance lvconvert (lib/metadata/raid_manip.c) to shift the dedicated
parity SubLVs on conversions from striped/raid0* to raid4 and vice-versa.
In case of raid0_meta -> raid4 where the MD raid0 personality already has
stored RAID array device positions in the superblocks, the MetaLVs have to
be cleared so that the kernel doesn't fail validating the array positions
after lvm has shifted them up by one.
Add more tests to lvconvert-raid-takeover.sh including one to check for
mapping flaws by converting a created raid4 with filesystem -> striped
and fsck it.
Whilst on it:
- add missing direct striped -> raid4 conversion to the takeover array
to avoid an intermim conversion from striped -> raid0*
- clean up the takeover array
- allow lvconvert to actually call lv_raid_convert() on all takeover requests
in order to check parameters and display messages provided by takeover
functions rather than just "...not supported" from within lvconvert
- fix a typo
Resolves: rhbz1386148
Diffstat (limited to 'test/shell/lvconvert-raid-takeover.sh')
-rw-r--r-- | test/shell/lvconvert-raid-takeover.sh | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/test/shell/lvconvert-raid-takeover.sh b/test/shell/lvconvert-raid-takeover.sh index 19a65d399..0140e22a0 100644 --- a/test/shell/lvconvert-raid-takeover.sh +++ b/test/shell/lvconvert-raid-takeover.sh @@ -78,22 +78,58 @@ aux wait_for_sync $vg $lv1 # Clean up lvremove --yes $vg/$lv1 -# Create 3-way raid0 -lvcreate -y -aey --type raid0 -i 3 -L 64M -n $lv1 $vg -check lv_field $vg/$lv1 segtype "raid0" +# Create 3-way striped +lvcreate -y -aey --type striped -i 3 -L 64M -n $lv1 $vg +check lv_field $vg/$lv1 segtype "striped" check lv_field $vg/$lv1 stripes 3 echo y | mkfs -t ext4 /dev/mapper/$vg-$lv1 fsck -fn /dev/mapper/$vg-$lv1 -# Convert raid0 -> raid4 +# Create 3-way raid0 +lvcreate -y -aey --type raid0 -i 3 -L 64M -n $lv2 $vg +check lv_field $vg/$lv2 segtype "raid0" +check lv_field $vg/$lv2 stripes 3 +echo y | mkfs -t ext4 /dev/mapper/$vg-$lv2 +fsck -fn /dev/mapper/$vg-$lv2 + +# Create 3-way raid0_meta +lvcreate -y -aey --type raid0_meta -i 3 -L 64M -n $lv3 $vg +check lv_field $vg/$lv3 segtype "raid0_meta" +check lv_field $vg/$lv3 stripes 3 +echo y | mkfs -t ext4 /dev/mapper/$vg-$lv3 +fsck -fn /dev/mapper/$vg-$lv3 + +# Create 3-way raid4 +lvcreate -y -aey --type raid4 -i 3 -L 64M -n $lv4 $vg +check lv_field $vg/$lv4 segtype "raid4" +check lv_field $vg/$lv4 stripes 4 +echo y | mkfs -t ext4 /dev/mapper/$vg-$lv4 +fsck -fn /dev/mapper/$vg-$lv4 +aux wait_for_sync $vg $lv4 +fsck -fn /dev/mapper/$vg-$lv4 + +# Convert raid4 -> striped (correct raid4 mapping test!) +lvconvert -y --ty striped $vg/$lv4 +check lv_field $vg/$lv4 segtype "striped" +check lv_field $vg/$lv4 stripes 3 +fsck -fn /dev/mapper/$vg-$lv4 + +# Convert striped -> raid4 lvconvert -y --ty raid4 $vg/$lv1 -lvchange --refresh $vg/$lv1 check lv_field $vg/$lv1 segtype "raid4" check lv_field $vg/$lv1 stripes 4 fsck -fn /dev/mapper/$vg-$lv1 aux wait_for_sync $vg $lv1 fsck -fn /dev/mapper/$vg-$lv1 +# Convert raid0 -> raid4 +lvconvert -y --ty raid4 $vg/$lv2 +check lv_field $vg/$lv2 segtype "raid4" +check lv_field $vg/$lv2 stripes 4 +fsck -fn /dev/mapper/$vg-$lv2 +aux wait_for_sync $vg $lv2 +fsck -fn /dev/mapper/$vg-$lv2 + # Convert raid4 -> raid0_meta lvconvert -y --ty raid0_meta $vg/$lv1 check lv_field $vg/$lv1 segtype "raid0_meta" @@ -116,11 +152,16 @@ fsck -fn /dev/mapper/$vg-$lv1 # Convert raid0 -> raid4 lvconvert -y --ty raid4 $vg/$lv1 -lvchange --refresh $vg/$lv1 check lv_field $vg/$lv1 segtype "raid4" check lv_field $vg/$lv1 stripes 4 fsck -fn /dev/mapper/$vg-$lv1 aux wait_for_sync $vg $lv1 fsck -fn /dev/mapper/$vg-$lv1 +# Convert raid4 -> striped +lvconvert -y --ty striped $vg/$lv1 +check lv_field $vg/$lv1 segtype "striped" +check lv_field $vg/$lv1 stripes 3 +fsck -fn /dev/mapper/$vg-$lv1 + vgremove -ff $vg |