diff options
Diffstat (limited to 'test/shell/lvconvert-mirror-basic.sh')
-rw-r--r-- | test/shell/lvconvert-mirror-basic.sh | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/test/shell/lvconvert-mirror-basic.sh b/test/shell/lvconvert-mirror-basic.sh index a0f50f6..96d30d2 100644 --- a/test/shell/lvconvert-mirror-basic.sh +++ b/test/shell/lvconvert-mirror-basic.sh @@ -1,4 +1,5 @@ -#!/bin/sh +#!/usr/bin/env bash + # Copyright (C) 2010-2012 Red Hat, Inc. All rights reserved. # # This copyrighted material is made available to anyone wishing to use, @@ -7,9 +8,13 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + + +. lib/inittest -. lib/test +aux lvmconf "global/support_mirrored_mirror_log=1" log_name_to_count() { case "$1" in @@ -38,28 +43,27 @@ log_name_to_count() { test_lvconvert() { local start_count=$1 - local start_count_p1=$(($start_count + 1)) + local start_count_p1=$(( start_count + 1 )) local start_log_type=$2 local finish_count=$3 - local finish_count_p1=$(($finish_count + 1)) + local finish_count_p1=$(( finish_count + 1 )) local finish_log_type=$4 - local dev_array=("$dev1" "$dev2" "$dev3" "$dev4" "$dev5") local start_log_count local finish_log_count local max_log_count local alloc="" - local active=true + local active="-aey" local i - test "$5" = "active" && active=false + test "$5" = "active" && active="-an" #test $finish_count -gt $start_count && up=true # Do we have enough devices for the mirror images? - test $start_count_p1 -gt ${#dev_array[@]} && \ + test $start_count_p1 -gt ${#DEVICES[@]} && \ die "Action requires too many devices" # Do we have enough devices for the mirror images? - test $finish_count_p1 -gt ${#dev_array[@]} && \ + test $finish_count_p1 -gt ${#DEVICES[@]} && \ die "Action requires too many devices" start_log_count=$(log_name_to_count $start_log_type) @@ -72,30 +76,37 @@ test_lvconvert() { if [ $start_count -gt 0 ]; then # Are there extra devices for the log or do we overlap - if [ $(($start_count_p1 + $start_log_count)) -gt ${#dev_array[@]} ]; then + if [ $(( start_count_p1 + start_log_count )) -gt ${#DEVICES[@]} ]; then alloc="--alloc anywhere" fi - lvcreate -l2 -m $start_count --mirrorlog $start_log_type \ + lvcreate "$active" -Zn -l2 --type mirror -m $start_count --mirrorlog $start_log_type \ -n $lv1 $vg $alloc check mirror_legs $vg $lv1 $start_count_p1 # FIXME: check mirror log else - lvcreate -l2 -n $lv1 $vg + lvcreate "$active" -Zn -l2 -n $lv1 $vg fi lvs -a -o name,copy_percent,devices $vg - test $active || lvchange -an $vg/$lv1 # Are there extra devices for the log or do we overlap - if [ $(($finish_count_p1 + $finish_log_count)) -gt ${#dev_array[@]} ]; then + if [ $(( finish_count_p1 + finish_log_count )) -gt ${#DEVICES[@]} ]; then alloc="--alloc anywhere" fi - lvconvert -m $finish_count --mirrorlog $finish_log_type \ + # --mirrorlog is invalid with -m0 + if [ "$finish_count" -eq 0 ]; then + mirrorlog="" + finish_log_type="" + else + mirrorlog="--mirrorlog" + fi + + lvconvert --type mirror -m $finish_count $mirrorlog $finish_log_type \ $vg/$lv1 $alloc - test $active || lvchange -ay $vg/$lv1 + test "$active" = "-an" || lvchange "$active" $vg/$lv1 check mirror_no_temporaries $vg $lv1 if [ "$finish_count_p1" -eq 1 ]; then @@ -110,14 +121,18 @@ test_lvconvert() { fi } -aux prepare_pvs 5 5 -vgcreate -c n -s 128k $vg $(cat DEVICES) +aux prepare_vg 5 5 +get_devs + +MIRRORED="mirrored" +# FIXME: Cluster is not supporting exlusive activation of mirrored log +test -e LOCAL_CLVMD && MIRRORED= test_many() { i=$1 for j in $(seq 0 3); do - for k in core disk mirrored; do - for l in core disk mirrored; do + for k in core disk $MIRRORED; do + for l in core disk $MIRRORED; do if test "$i" -eq "$j" && test "$k" = "$l"; then continue; fi : ---------------------------------------------------- : "Testing mirror conversion -m$i/$k -> -m$j/$l" |