master - lvconvert: rework routing of operations
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2282f53ac73d33311661226894ee90e72772f0db Commit: 2282f53ac73d33311661226894ee90e72772f0db Parent: eac0706761e628532ffcd27f3e4d7fa559a5f818 Author: David Teigland <[email protected]> AuthorDate: Tue Jun 28 12:24:41 2016 -0500 Committer: David Teigland <[email protected]> CommitterDate: Wed Jun 29 16:55:27 2016 -0500
lvconvert: rework routing of operations
Add new logic to identify each unique operation and route it to the correct function to perform it. The functions that perform the conversions remain unchanged.
This new code checks every allowed combination of LV type and requested operation, and for each valid combination calls the function that performs that conversion.
The first stage of option validation which checks for incompatible combinations of command line options, is done done before process_each is called. This is unchanged. (This new code will allow that first stage validation to be simplified in a future commit.)
The second stage of checking options against the specific LV type is done by this new code. For each valid combination of operation + LV type, the new code calls an existing function that implements it.
With this in place, the ad hoc checks for valid combinations of LV types and operations can be removed from the existing code in a future commit.
(The #if 0 is used to keep the patch clean, and the disabled code will be removed by a following patch.)
--- test/shell/lvconvert-cache.sh | 2 +- test/shell/lvconvert-mirror.sh | 21 +- tools/lvconvert.c | 786 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 799 insertions(+), 10 deletions(-)
test/shell/lvconvert-cache.sh +1 -1
@@ -144,7 +144,7 @@ lvcreate -H -L 4 -n corigin --cachepool $vg/cpool # unsupported yet fail lvconvert --repair $vg/cpool 2>&1 | tee out -grep "not yet implemented" out +grep "Cannot convert internal LV" out lvremove -f $vg
test/shell/lvconvert-mirror.sh +12 -9
@@ -85,9 +85,12 @@ offset=$(( offset + 2 )) # update in case mirror ever gets faster and allows parallel read aux delay_dev "$dev2" 0 2000 ${offset}:1 lvcreate -aey -l5 -Zn -Wn --type mirror --regionsize 16K -m2 -n $lv1 $vg "$dev1" "$dev2" "$dev4" "$dev3:$DEVRANGE" +# FIXME: add a new explicit option to define the polling behavior +# done here with 'lvconvert vg/lv'. That option can specify +# that the command succeeds even if the LV doesn't need polling. should not lvconvert -m-1 $vg/$lv1 "$dev1" aux enable_dev "$dev2" -lvconvert $vg/$lv1 # wait +should lvconvert $vg/$lv1 # wait lvconvert -m2 $vg/$lv1 "$dev1" "$dev2" "$dev4" "$dev3:0" # If the above "should" failed... aux wait_for_sync $vg $lv1
@@ -113,7 +116,7 @@ LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4" # Next convert should fail b/c we can't have 2 at once should not lvconvert -m+1 $vg/$lv1 "$dev5" aux enable_dev "$dev4" -lvconvert $vg/$lv1 # wait +should lvconvert $vg/$lv1 # wait lvconvert -m2 $vg/$lv1 # In case the above "should" actually failed check mirror $vg $lv1 "$dev3"
@@ -156,7 +159,7 @@ lvcreate -aey -l2 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE lvchange -an $vg/$lv1 lvconvert -m+1 $vg/$lv1 "$dev4" lvchange -aey $vg/$lv1 -lvconvert $vg/$lv1 # wait +should lvconvert $vg/$lv1 # wait check mirror $vg $lv1 "$dev3" check mirror_no_temporaries $vg $lv1 lvremove -ff $vg
@@ -168,7 +171,7 @@ lvremove -ff $vg lvcreate -aey -l2 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE" LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4" lvconvert -m-1 $vg/$lv1 "$dev4" -lvconvert $vg/$lv1 # wait +should lvconvert $vg/$lv1 # wait check mirror $vg $lv1 "$dev3" check mirror_no_temporaries $vg $lv1
@@ -179,7 +182,7 @@ lvremove -ff $vg lvcreate -aey -l2 --type mirror -m1 -n $lv1 $vg "$dev1" "$dev2" "$dev3:$DEVRANGE" LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+2 -b $vg/$lv1 "$dev4" "$dev5" lvconvert -m-1 $vg/$lv1 "$dev4" -lvconvert $vg/$lv1 # wait +should lvconvert $vg/$lv1 # wait check mirror $vg $lv1 "$dev3" check mirror_no_temporaries $vg $lv1
@@ -192,9 +195,9 @@ LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4" # FIXME: Extra wait here for mirror upconvert synchronization # otherwise we may fail her on parallel upconvert and downconvert # lvconvert-mirror-updown.sh tests this errornous case separately -lvconvert $vg/$lv1 +should lvconvert $vg/$lv1 lvconvert -m-1 $vg/$lv1 "$dev2" -lvconvert $vg/$lv1 +should lvconvert $vg/$lv1 check mirror $vg $lv1 "$dev3" check mirror_no_temporaries $vg $lv1
@@ -207,9 +210,9 @@ LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -m+1 -b $vg/$lv1 "$dev4" # FIXME: Extra wait here for mirror upconvert synchronization # otherwise we may fail her on parallel upconvert and downconvert # lvconvert-mirror-updown.sh tests this errornous case separately -lvconvert $vg/$lv1 +should lvconvert $vg/$lv1 lvconvert -m-1 $vg/$lv1 "$dev2" -lvconvert $vg/$lv1 +should lvconvert $vg/$lv1 check mirror $vg $lv1 "$dev3" check mirror_no_temporaries $vg $lv1
tools/lvconvert.c +786 -0
817 lines not on this page · raw message