1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

RAID: Fix bug making lvchange unable to change recovery rate for RAID

1) Since the min|maxrecoveryrate args are size_kb_ARGs and they
   are recorded (and sent to the kernel) in terms of kB/sec/disk,
   we must back out the factor multiple done by size_kb_arg.  This
   is already performed by 'lvcreate' for these arguments.
2) Allow all RAID types, not just RAID1, to change these values.
3) Add min|maxrecoveryrate_ARG to the list of 'update_partial_unsafe'
   commands so that lvchange will not complain about needing at
   least one of a certain set of arguments and failing.
4) Add tests that check that these values can be set via lvchange
   and lvcreate and that 'lvs' reports back the proper results.
This commit is contained in:
Jonathan Brassow 2013-08-09 17:09:47 -05:00
parent a1dc585fa6
commit 8615234c0f
5 changed files with 53 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.100 -
================================
Fix bug making lvchange unable to change recovery rate for RAID.
Prohibit convertion of thin pool to external origin.
Workaround gcc v4.8 -O2 bug causing failures if config/checks=1 (32bit arch).
Verify clvmd message validity before processing and log error if incorrect.

View File

@ -214,6 +214,19 @@ run_refresh_check() {
lvs --noheadings -o lv_attr $1/$2 | grep '.*-.$'
}
# run_recovery_rate_check <VG> <LV>
# Assumes "$dev2" is in the array
run_recovery_rate_check() {
printf "#\n#\n#\n# %s/%s (%s): run_recovery_rate_check\n#\n#\n#\n" \
$1 $2 `lvs --noheadings -o segtype $1/$2`
lvchange --minrecoveryrate 50 $1/$2
lvchange --maxrecoveryrate 100 $1/$2
[ `lvs --noheadings -o raid_min_recovery_rate $1/$2` == "50" ]
[ `lvs --noheadings -o raid_max_recovery_rate $1/$2` == "100" ]
}
# run_checks <VG> <LV> [snapshot_dev]
run_checks() {
# Without snapshots
@ -223,6 +236,8 @@ run_checks() {
run_refresh_check $1 $2
run_recovery_rate_check $1 $2
# With snapshots
if [ ! -z $3 ]; then
lvcreate -s $1/$2 -l 4 -n snap $3
@ -233,6 +248,8 @@ run_checks() {
run_refresh_check $1 $2
run_recovery_rate_check $1 $2
lvremove -ff $1/snap
fi
}

View File

@ -38,6 +38,15 @@ lvcreate --type raid1 -m 2 -l 2 -n $lv1 $vg
aux wait_for_sync $vg $lv1
lvremove -ff $vg
# Create RAID1 (explicit 3-way) - Set min/max recovery rate
lvcreate --type raid1 -m 2 -l 2 \
--minrecoveryrate 50 --maxrecoveryrate 100 \
-n $lv1 $vg
[ `lvs --noheadings -o raid_min_recovery_rate $vg/$lv1` -eq 50 ]
[ `lvs --noheadings -o raid_max_recovery_rate $vg/$lv1` -eq 100 ]
aux wait_for_sync $vg $lv1
lvremove -ff $vg
# Create RAID 4/5/6 (explicit 3-stripe + parity devs)
for i in raid4 \
raid5 raid5_ls raid5_la raid5_rs raid5_ra \
@ -47,3 +56,17 @@ for i in raid4 \
aux wait_for_sync $vg $lv1
lvremove -ff $vg
done
# Create RAID 4/5/6 (explicit 3-stripe + parity devs) - Set min/max recovery
for i in raid4 \
raid5 raid5_ls raid5_la raid5_rs raid5_ra \
raid6 raid6_zr raid6_nr raid6_nc; do
lvcreate --type $i -l 3 -i 3 \
--minrecoveryrate 50 --maxrecoveryrate 100 \
-n $lv1 $vg
[ `lvs --noheadings -o raid_min_recovery_rate $vg/$lv1` -eq 50 ]
[ `lvs --noheadings -o raid_max_recovery_rate $vg/$lv1` -eq 100 ]
aux wait_for_sync $vg $lv1
lvremove -ff $vg
done

View File

@ -30,6 +30,15 @@ not lvcreate --type raid10 -m 2 -i 2 -l 2 -n $lv1 $vg
# 2-way mirror, 2-stripes
lvcreate --type raid10 -m 1 -i 2 -l 2 -n $lv1 $vg
aux wait_for_sync $vg $lv1
lvremove -ff $vg/$lv1
# 2-way mirror, 2-stripes - Set min/max recovery rate
lvcreate --type raid10 -m 1 -i 2 -l 2 \
--minrecoveryrate 50 --maxrecoveryrate 100 \
-n $lv1 $vg
[ `lvs --noheadings -o raid_min_recovery_rate $vg/$lv1` -eq 50 ]
[ `lvs --noheadings -o raid_max_recovery_rate $vg/$lv1` -eq 100 ]
aux wait_for_sync $vg $lv1
# 2-way mirror, 3-stripes
lvcreate --type raid10 -m 1 -i 3 -l 3 -n $lv2 $vg

View File

@ -1143,9 +1143,11 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
arg_count(cmd, detachprofile_ARG) ||
arg_count(cmd, setactivationskip_ARG);
int update_partial_unsafe =
arg_count(cmd, resync_ARG) ||
arg_count(cmd, alloc_ARG) ||
arg_count(cmd, discards_ARG) ||
arg_count(cmd, resync_ARG) ||
arg_count(cmd, raidminrecoveryrate_ARG) ||
arg_count(cmd, raidmaxrecoveryrate_ARG) ||
arg_count(cmd, syncaction_ARG) ||
arg_count(cmd, writebehind_ARG) ||
arg_count(cmd, writemostly_ARG) ||