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

pvmove: fix regression introduced with 8e9d5d12ae

'pvmove -n name pv1 pv2' called with the name of a top-level LV
failed with mentioned commit.

Enhance pvmove-raid-segtypes.sh to test for prohibited RAID SubLV moves.
This commit is contained in:
Heinz Mauelshagen 2016-08-15 19:31:04 +02:00
parent 8e9d5d12ae
commit d83f2d766d
2 changed files with 13 additions and 1 deletions

View File

@ -53,6 +53,15 @@ lvcreate -l 4 --type raid10 -i 2 -m 1 -n $lv1 $vg \
check lv_tree_on $vg ${lv1}_foo "$dev1"
check lv_tree_on $vg $lv1 "$dev1" "$dev2" "$dev3" "$dev4"
aux mkdev_md5sum $vg $lv1
# Check collocation of SubLVs is prohibited
not pvmove $mode -n ${lv1}_rimage_0 "$dev1" "$dev2"
check lv_tree_on $vg $lv1 "$dev1" "$dev2" "$dev3" "$dev4"
not pvmove $mode -n ${lv1}_rimage_1 "$dev2" "$dev1"
check lv_tree_on $vg $lv1 "$dev1" "$dev2" "$dev3" "$dev4"
not pvmove $mode -n ${lv1}_rmeta_0 "$dev1" "$dev3"
check lv_tree_on $vg $lv1 "$dev1" "$dev2" "$dev3" "$dev4"
pvmove $mode "$dev1" "$dev5"
check lv_tree_on $vg ${lv1}_foo "$dev5"
check lv_tree_on $vg $lv1 "$dev2" "$dev3" "$dev4" "$dev5"

View File

@ -163,7 +163,8 @@ static int _remove_sibling_pvs_from_trim_list(struct logical_volume *lv,
/* Give up with success unless @lv_name _and_ valid raid segment type */
if (!lv_name || !*lv_name ||
!seg_is_raid(first_seg(lv)) ||
seg_is_raid0(first_seg(lv)))
seg_is_raid0(first_seg(lv)) ||
!strcmp(lv->name, lv_name))
return 1;
dm_list_init(&untrim_list);
@ -427,6 +428,8 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
* for collocation (e.g. *rmeta_0 -> *rimage_0).
*
* Callee checks for lv_name and valid raid segment type.
*
* FIXME: don't rely on namespace
*/
if (!_remove_sibling_pvs_from_trim_list(lv, lv_name, &trim_list))
return_NULL;