master - lvconvert: add infrastructure for RaidLV reshaping support
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=34caf8317243b3b30e6fc858b4440ebf3ffb8810 Commit: 34caf8317243b3b30e6fc858b4440ebf3ffb8810 Parent: f79bd30a8be0d189c417a76d1ca6b64f70a8832e Author: Heinz Mauelshagen <[email protected]> AuthorDate: Fri Feb 24 04:36:03 2017 +0100 Committer: Heinz Mauelshagen <[email protected]> CommitterDate: Fri Feb 24 05:20:58 2017 +0100
lvconvert: add infrastructure for RaidLV reshaping support
In order to support striped raid5/6/10 LV reshaping (change of LV type, stripesize or number of legs), this patch introduces the changes to call the reshaping infratructure from lv_raid_convert().
Changes:
- add reshaping calls from lv_raid_convert()
- add command definitons for reshaping to tools/command-lines.in
- fix raid_rimage_extents()
- add 2 new test scripts lvconvert-raid-reshape-linear_to_striped.sh and lvconvert-raid-reshape-striped_to_linear.sh to test the linear <-> striped multi-step conversions
- add lvconvert-raid-reshape.sh reshaping tests
- enhance lvconvert-raid-takeover.sh with new raid10 tests
Related: rhbz834579
Related: rhbz1191935
Related: rhbz1191978
--- lib/config/defaults.h | 2 +- lib/metadata/raid_manip.c | 50 +++++++++++++++++++++------------ test/lib/aux.sh | 2 +- test/lib/check.sh | 13 +++++++- test/lib/get.sh | 5 +++ test/shell/lvconvert-raid-takeover.sh | 11 +++++-- tools/command-lines.in | 29 +++++++++++++++++++ 7 files changed, 87 insertions(+), 25 deletions(-)
lib/config/defaults.h +1 -1
@@ -72,7 +72,7 @@* once the SubLVs split and name shift got enhanced */ #define DEFAULT_RAID1_MAX_IMAGES 10 -#define DEFAULT_RAID_MAX_IMAGES 64 +#define DEFAULT_RAID_MAX_IMAGES 10#define DEFAULT_ALLOCATION_STRIPE_ALL_DEVICES 0/* Don't stripe across all devices if not -i/--stripes given */ #define DEFAULT_RAID_FAULT_POLICY "warn"
lib/metadata/raid_manip.c +32 -18
94 lines not on this page · raw message
test/lib/aux.sh +1 -1
@@ -1317,7 +1317,7 @@ udev_wait() { wait_for_sync() { local i for i in {1..100} ; do - check in_sync $1 $2 && return + check in_sync $1 $2 $3 && return sleep .2 done
test/lib/check.sh +11 -2
@@ -178,7 +178,7 @@ linear() { $(lvl $lv -o+devices) } -# in_sync <VG> <LV> +# in_sync <VG> <LV> <ignore 'a'> # Works for "mirror" and "raid*" in_sync() { local a
@@ -187,8 +187,11 @@ in_sync() { local type local snap="" local lvm_name="$1/$2" + local ignore_a="$3" local dm_name=$(echo $lvm_name | sed s:-:--: | sed s:/:-:) + [ -z "$ignore_a" ] && ignore_a=0 + a=( $(dmsetup status $dm_name) ) || \ die "Unable to get sync status of $1"
@@ -225,7 +228,7 @@ in_sync() { return 1 fi - [[ ${a[$(($idx - 1))]} =~ a ]] && \ + [[ ${a[$(($idx - 1))]} =~ a ]] && [ $ignore_a -eq 0 ] && \ die "$lvm_name ($type$snap) in-sync, but 'a' characters in health status" echo "$lvm_name ($type$snap) is in-sync \"${a[@]}\""
@@ -310,6 +313,12 @@ lv_field() { die "lv_field: lv=$1, field=\"$2\", actual=\"$actual\", expected=\"$3\"" } +lv_first_seg_field() { + local actual=$(get lv_first_seg_field "$1" "$2" "${@:4}") + test "$actual" = "$3" || \ + die "lv_field: lv=$1, field=\"$2\", actual=\"$actual\", expected=\"$3\"" +} + lvh_field() { local actual=$(get lvh_field "$1" "$2" "${@:4}") test "$actual" = "$3" || \
test/lib/get.sh +5 -0
@@ -42,6 +42,11 @@ lv_field() { trim_ "$r" } +lv_first_seg_field() { + local r=$(lvs --config 'log{prefix=""}' --noheadings -o "$2" "${@:3}" "$1" | head -1) + trim_ "$r" +} + lvh_field() { local r=$(lvs -H --config 'log{prefix=""}' --noheadings -o "$2" "${@:3}" "$1") trim_ "$r"
test/shell/lvconvert-raid-takeover.sh +8 -3
@@ -117,8 +117,7 @@ fsck -fn "$DM_DEV_DIR/$vg/$lv1" lvconvert -m 4 -R 128K $vg/$lv1 check lv_field $vg/$lv1 segtype "raid1" check lv_field $vg/$lv1 stripes 5 -# FIXME: once lv_raid_chanage_image_count() supports region_size changes -not check lv_field $vg/$lv1 regionsize "128.00k" +check lv_field $vg/$lv1 regionsize "128.00k" fsck -fn "$DM_DEV_DIR/$vg/$lv1" aux wait_for_sync $vg $lv1 fsck -fn "$DM_DEV_DIR/$vg/$lv1"
@@ -258,7 +257,13 @@ _lvconvert raid0 raid0 3 $vg $lv1 # Convert raid0 -> raid10 _lvconvert raid10 raid10 6 $vg $lv1 -# Convert raid10 -> raid0 +# Convert raid10 -> raid0_meta +_lvconvert raid0_meta raid0_meta 3 $vg $lv1 + +# Convert raid0_meta -> raid5 +_lvconvert raid5_n raid5_n 4 $vg $lv1 + +# Convert raid5_n -> raid0_meta _lvconvert raid0_meta raid0_meta 3 $vg $lv1 # Convert raid0_meta -> raid10
tools/command-lines.in +29 -0
@@ -345,6 +345,13 @@ ID: lvconvert_raid_types DESC: Convert LV to raid. RULE: all not lv_is_locked lv_is_pvmove +lvconvert --type raid LV_raid +OO: OO_LVCONVERT_RAID, OO_LVCONVERT +ID: lvconvert_raid_types +DESC: Convert raid LV to different layout algorithm. +RULE: all not lv_is_locked lv_is_pvmove +RULE: all not LV_raid0 LV_raid1 + lvconvert --mirrors SNumber LV OO: OO_LVCONVERT_RAID, OO_LVCONVERT, --mirrorlog MirrorLog OP: PV ...
@@ -352,6 +359,21 @@ ID: lvconvert_raid_types DESC: Convert LV to raid1 or mirror, or change number of mirror images. RULE: all not lv_is_locked lv_is_pvmove +lvconvert --stripes_long SNumber LV_raid +OO: OO_LVCONVERT_RAID, OO_LVCONVERT +OP: PV ... +ID: lvconvert_raid_types +DESC: Convert raid LV to change number of stripe images. +RULE: all not lv_is_locked lv_is_pvmove +RULE: all not LV_raid0 LV_raid1 + +lvconvert --stripesize SizeKB LV_raid +OO: OO_LVCONVERT_RAID, OO_LVCONVERT +ID: lvconvert_raid_types +DESC: Convert raid LV to change the stripe size. +RULE: all not lv_is_locked lv_is_pvmove +RULE: all not LV_raid0 LV_raid1 + lvconvert --regionsize RegionSize LV_raid OO: OO_LVCONVERT ID: lvconvert_change_region_size
@@ -359,6 +381,13 @@ DESC: Change the region size of an LV. RULE: all not lv_is_locked lv_is_pvmove RULE: all not LV_raid0 +lvconvert LV_mirror_raid +OO: OO_LVCONVERT +ID: lvconvert_raid_types +DESC: Remove out-of-place reshape space +RULE: all not lv_is_locked lv_is_pvmove +RULE: all not LV_raid0 LV_raid1 + --- # lvconvert raid-related utilities