mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
48778bc503
During an ongoing reshape, the MD kernel runtime reads stripes relative to data_offset and starts storing the reshaped stripes (with new raid layout and/or new stripesize and/or new number of stripes) relative to new_data_offset. This is to avoid writing over any data in place which is non-atomic by nature and thus be recoverable without data loss in the transition. MD uses the term out-of-place reshaping for it. There's 2 other areas we don't have report capability for: - number of data stripes vs. total stripes (e.g. raid6 with 7 stripes toal has 5 data stripes) - number of (rotating) parity/syndrome chunks (e.g. raid6 with 7 stripes toal has 2 parity chunks; one per stripe for P-Syndrome and another one for Q-Syndrome) Thus, add the following reportable keys: - reshape_len (in current units) - reshape_len_le (in logical extents) - data_offset (in sectors) - new_data_offset ( " ) - data_stripes - parity_chunks Enhance lvchange-raid.sh, lvconvert-raid-reshape-linear_to_striped.sh, lvconvert-raid-reshape-striped_to_linear.sh, lvconvert-raid-reshape.sh and lvconvert-raid-takeover.sh to make use of new keys. Related: rhbz834579 Related: rhbz1191935 Related: rhbz1191978
69 lines
2.0 KiB
Bash
69 lines
2.0 KiB
Bash
#!/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 linear LV
|
|
lvcreate -aey -L 16M -n $lv1 $vg
|
|
check lv_field $vg/$lv1 segtype "linear"
|
|
check lv_field $vg/$lv1 stripes 1
|
|
check lv_field $vg/$lv1 data_stripes 1
|
|
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
|
|
check lv_field $vg/$lv1 data_stripes 2
|
|
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
|
|
lvconvert -y --ty raid5_n $vg/$lv1
|
|
fsck -fn $DM_DEV_DIR/$vg/$lv1
|
|
check lv_field $vg/$lv1 segtype "raid5_n"
|
|
check lv_field $vg/$lv1 stripes 2
|
|
check lv_field $vg/$lv1 data_stripes 1
|
|
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"
|
|
check lv_first_seg_field $vg/$lv1 data_stripes 4
|
|
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"
|
|
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
|