mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Testsuite updates and fixes for recently added features.
1. Found bug in 'redundant log' implementation that caused problems when converting a linear that spanned multiple devices to a mirror (wasn't checking for NULL value of provided parameter in _alloc_parallel_area) 2. Testsuite was failing to perform tests when 'not' modifier was used. This allowed a couple issues to slip through. Added a 'not_sh' modifier that negates tests performed by functions defined in the shell source file. 3. Was initializing a variable to far down, which cause previously set value to be overridden. (This was the result of the collision of the "redundant log" and lvconvert fix patches.)
This commit is contained in:
parent
e55df6fee5
commit
673421ffc2
@ -762,7 +762,7 @@ static int _alloc_parallel_area(struct alloc_handle *ah, uint32_t needed,
|
|||||||
consume_pv_area(areas[s], area_len);
|
consume_pv_area(areas[s], area_len);
|
||||||
|
|
||||||
for (i = 0, s = ah->area_count;
|
for (i = 0, s = ah->area_count;
|
||||||
(s < ah->area_count + ah->log_count);
|
log_areas && (s < ah->area_count + ah->log_count);
|
||||||
s++, i++) {
|
s++, i++) {
|
||||||
aa[s].pv = log_areas[i]->map->pv;
|
aa[s].pv = log_areas[i]->map->pv;
|
||||||
aa[s].pe = log_areas[i]->start;
|
aa[s].pe = log_areas[i]->start;
|
||||||
|
@ -128,6 +128,12 @@ check_and_cleanup_lvs_()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
not_sh ()
|
||||||
|
{
|
||||||
|
"$@" && exit 1 || :;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
prepare_lvs_
|
prepare_lvs_
|
||||||
check_and_cleanup_lvs_
|
check_and_cleanup_lvs_
|
||||||
|
|
||||||
@ -149,6 +155,19 @@ mimages_are_redundant_ $vg $lv1
|
|||||||
mirrorlog_is_on_ $vg/$lv1 $dev3
|
mirrorlog_is_on_ $vg/$lv1 $dev3
|
||||||
check_and_cleanup_lvs_
|
check_and_cleanup_lvs_
|
||||||
|
|
||||||
|
# remove 1 mirror from corelog'ed mirror
|
||||||
|
# should retain 'core' log type
|
||||||
|
prepare_lvs_
|
||||||
|
lvcreate -l2 -m2 --corelog -n $lv1 $vg
|
||||||
|
check_mirror_count_ $vg/$lv1 3
|
||||||
|
not_sh check_mirror_log_ $vg/$lv1
|
||||||
|
lvconvert -m -1 -i1 $vg/$lv1
|
||||||
|
check_no_tmplvs_ $vg/$lv1
|
||||||
|
check_mirror_count_ $vg/$lv1 2
|
||||||
|
mimages_are_redundant_ $vg $lv1
|
||||||
|
not_sh check_mirror_log_ $vg/$lv1
|
||||||
|
check_and_cleanup_lvs_
|
||||||
|
|
||||||
# add 2 mirrors
|
# add 2 mirrors
|
||||||
prepare_lvs_
|
prepare_lvs_
|
||||||
lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
|
lvcreate -l2 -m1 -n $lv1 $vg $dev1 $dev2 $dev3:0-1
|
||||||
@ -161,27 +180,41 @@ mimages_are_redundant_ $vg $lv1
|
|||||||
mirrorlog_is_on_ $vg/$lv1 $dev3
|
mirrorlog_is_on_ $vg/$lv1 $dev3
|
||||||
check_and_cleanup_lvs_
|
check_and_cleanup_lvs_
|
||||||
|
|
||||||
# add 1 mirror to core log mirror
|
# add 1 mirror to core log mirror,
|
||||||
|
# explicitly keep log as 'core'
|
||||||
prepare_lvs_
|
prepare_lvs_
|
||||||
lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2
|
lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2
|
||||||
check_mirror_count_ $vg/$lv1 2
|
check_mirror_count_ $vg/$lv1 2
|
||||||
not check_mirror_log_ $vg/$lv1
|
not_sh check_mirror_log_ $vg/$lv1
|
||||||
lvconvert -m+1 -i1 --mirrorlog core $vg/$lv1 $dev4
|
lvconvert -m+1 -i1 --mirrorlog core $vg/$lv1 $dev4
|
||||||
check_no_tmplvs_ $vg/$lv1
|
check_no_tmplvs_ $vg/$lv1
|
||||||
check_mirror_count_ $vg/$lv1 3
|
check_mirror_count_ $vg/$lv1 3
|
||||||
not check_mirror_log_ $vg/$lv1
|
not_sh check_mirror_log_ $vg/$lv1
|
||||||
mimages_are_redundant_ $vg $lv1
|
mimages_are_redundant_ $vg $lv1
|
||||||
check_and_cleanup_lvs_
|
check_and_cleanup_lvs_
|
||||||
|
|
||||||
|
# add 1 mirror to core log mirror, but
|
||||||
|
# implicitly keep log as 'core'
|
||||||
|
prepare_lvs_
|
||||||
|
lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2
|
||||||
|
check_mirror_count_ $vg/$lv1 2
|
||||||
|
not_sh check_mirror_log_ $vg/$lv1
|
||||||
|
lvconvert -m +1 -i1 $vg/$lv1
|
||||||
|
check_no_tmplvs_ $vg/$lv1
|
||||||
|
check_mirror_count_ $vg/$lv1 3
|
||||||
|
not_sh check_mirror_log_ $vg/$lv1
|
||||||
|
mimages_are_redundant_ $vg $lv1
|
||||||
|
check_and_cleanup_lvs_
|
||||||
|
|
||||||
# add 2 mirrors to core log mirror"
|
# add 2 mirrors to core log mirror"
|
||||||
prepare_lvs_
|
prepare_lvs_
|
||||||
lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2
|
lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2
|
||||||
check_mirror_count_ $vg/$lv1 2
|
check_mirror_count_ $vg/$lv1 2
|
||||||
not check_mirror_log_ $vg/$lv1
|
not_sh check_mirror_log_ $vg/$lv1
|
||||||
lvconvert -m+2 -i1 --mirrorlog core $vg/$lv1 $dev4 $dev5
|
lvconvert -m+2 -i1 --mirrorlog core $vg/$lv1 $dev4 $dev5
|
||||||
check_no_tmplvs_ $vg/$lv1
|
check_no_tmplvs_ $vg/$lv1
|
||||||
check_mirror_count_ $vg/$lv1 4
|
check_mirror_count_ $vg/$lv1 4
|
||||||
not check_mirror_log_ $vg/$lv1
|
not_sh check_mirror_log_ $vg/$lv1
|
||||||
mimages_are_redundant_ $vg $lv1
|
mimages_are_redundant_ $vg $lv1
|
||||||
check_and_cleanup_lvs_
|
check_and_cleanup_lvs_
|
||||||
|
|
||||||
@ -208,7 +241,7 @@ check_and_cleanup_lvs_
|
|||||||
prepare_lvs_
|
prepare_lvs_
|
||||||
lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2
|
lvcreate -l2 -m1 --mirrorlog core -n $lv1 $vg $dev1 $dev2
|
||||||
check_mirror_count_ $vg/$lv1 2
|
check_mirror_count_ $vg/$lv1 2
|
||||||
not check_mirror_log_ $vg/$lv1
|
not_sh check_mirror_log_ $vg/$lv1
|
||||||
lvconvert -m+1 --mirrorlog disk -i1 $vg/$lv1 $dev4 $dev3:0-1
|
lvconvert -m+1 --mirrorlog disk -i1 $vg/$lv1 $dev4 $dev3:0-1
|
||||||
check_no_tmplvs_ $vg/$lv1
|
check_no_tmplvs_ $vg/$lv1
|
||||||
check_mirror_count_ $vg/$lv1 3
|
check_mirror_count_ $vg/$lv1 3
|
||||||
|
@ -613,7 +613,7 @@ static int _lvconvert_mirrors(struct cmd_context *cmd, struct logical_volume *lv
|
|||||||
struct lv_segment *seg;
|
struct lv_segment *seg;
|
||||||
uint32_t existing_mirrors;
|
uint32_t existing_mirrors;
|
||||||
const char *mirrorlog;
|
const char *mirrorlog;
|
||||||
unsigned log_count = 0;
|
unsigned log_count = 1;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
struct logical_volume *log_lv, *layer_lv;
|
struct logical_volume *log_lv, *layer_lv;
|
||||||
int failed_mirrors = 0, failed_log = 0;
|
int failed_mirrors = 0, failed_log = 0;
|
||||||
@ -710,11 +710,6 @@ static int _lvconvert_mirrors(struct cmd_context *cmd, struct logical_volume *lv
|
|||||||
/*
|
/*
|
||||||
* Adjust log type
|
* Adjust log type
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
* This param used to be 'corelog' and was initialized to '0'.
|
|
||||||
* We initially set to '1' here so as not to screw the logic.
|
|
||||||
*/
|
|
||||||
log_count = 1;
|
|
||||||
if (arg_count(cmd, corelog_ARG))
|
if (arg_count(cmd, corelog_ARG))
|
||||||
log_count = 0;
|
log_count = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user