From: Jian Yu Date: Mon, 19 Jul 2010 07:35:11 +0000 (+0400) Subject: b=22348 improve get_mdtosc_proc_path() to handle 2.0 server on 1.8 disk X-Git-Tag: 2.0.50.0~38 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=1466e33057b58f8249d222c2b9c50e40bdebd5c2 b=22348 improve get_mdtosc_proc_path() to handle 2.0 server on 1.8 disk If the 2.0 MDS was mounted on 1.8 device, then the OSC and LOV names used by MDT would not be changed: mdt lov: fsname-mdtlov mdt osc: fsname-OSTXXXX-osc The patch is to improve get_mdtosc_proc_path() to get correct OSC name while 2.0 server being mounted on 1.8 disk. i=robert.read i=grev --- diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 9da812a..55d4868 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -866,7 +866,9 @@ test_29() { fi # check MDT too - local MPROC="osc.$FSNAME-OST0001-osc-[M]*.active" + local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0001) + mdtosc=${mdtosc/-MDT*/-MDT\*} + local MPROC="osc.$mdtosc.active" local MAX=30 local WAIT=0 while [ 1 ]; do diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index e9fb4d9..562def5 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -1083,7 +1083,9 @@ run_test 60 "Add Changelog entries during MDS failover" test_61() { - local cflags='osc.*-OST0000-osc-MDT*.connect_flags' + local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0000) + mdtosc=${mdtosc/-MDT*/-MDT\*} + local cflags="osc.$mdtosc.connect_flags" do_facet $SINGLEMDS "lctl get_param -n $cflags" |grep -q skip_orphan [ $? -ne 0 ] && skip "don't have skip orphan feature" && return diff --git a/lustre/tests/replay-single.sh b/lustre/tests/replay-single.sh index 1d073ec..67f83fa 100755 --- a/lustre/tests/replay-single.sh +++ b/lustre/tests/replay-single.sh @@ -891,7 +891,9 @@ test_41() { do_facet client dd if=/dev/zero of=$f bs=4k count=1 || return 3 cancel_lru_locks osc # fail ost2 and read from ost1 - local osc2dev=`do_facet $SINGLEMDS "lctl get_param -n devices | grep ${ost2_svc}-osc-MDT0000" | awk '{print $1}'` + local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost2_svc) + local osc2dev=$(do_facet $SINGLEMDS "lctl get_param -n devices" | \ + grep $mdtosc | awk '{print $1}') [ -z "$osc2dev" ] && echo "OST: $ost2_svc" && lctl get_param -n devices && return 4 do_facet $SINGLEMDS $LCTL --device $osc2dev deactivate || return 1 do_facet client dd if=$f of=/dev/null bs=4k count=1 || return 3 @@ -1065,7 +1067,9 @@ test_48() { run_test 48 "MDS->OSC failure during precreate cleanup (2824)" test_50() { - local oscdev=`do_facet $SINGLEMDS lctl get_param -n devices | grep ${ost1_svc}-osc-MDT0000 | awk '{print $1}'` + local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $ost1_svc) + local oscdev=$(do_facet $SINGLEMDS "lctl get_param -n devices" | \ + grep $mdtosc | awk '{print $1}') [ "$oscdev" ] || return 1 do_facet $SINGLEMDS $LCTL --device $oscdev recover || return 2 do_facet $SINGLEMDS $LCTL --device $oscdev recover || return 3 @@ -1757,9 +1761,11 @@ test_67b() #bug 3055 # exhaust precreations on ost1 local OST=$(lfs osts | grep ^0": " | awk '{print $2}' | sed -e 's/_UUID$//') - local mdtosc=$(get_mdtosc_proc_path $OST) - local last_id=$(do_facet mds lctl get_param -n osc.$mdtosc.prealloc_last_id) - local next_id=$(do_facet mds lctl get_param -n osc.$mdtosc.prealloc_next_id) + local mdtosc=$(get_mdtosc_proc_path mds $OST) + local last_id=$(do_facet mds lctl get_param -n \ + osc.$mdtosc.prealloc_last_id) + local next_id=$(do_facet mds lctl get_param -n \ + osc.$mdtosc.prealloc_next_id) mkdir -p $DIR/$tdir/${OST} lfs setstripe $DIR/$tdir/${OST} -o 0 -c 1 || error "setstripe" diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 85c0554..0fccad4 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1013,10 +1013,14 @@ exhaust_precreations() { sed -e 's/_UUID$//;s/^.*-//') # on the mdt's osc - local last_id=$(do_facet mds${MDSIDX} lctl get_param -n osc.*${OST}-osc-${MDT_INDEX}.prealloc_last_id) - local next_id=$(do_facet mds${MDSIDX} lctl get_param -n osc.*${OST}-osc-${MDT_INDEX}.prealloc_next_id) + local mdtosc_proc1=$(get_mdtosc_proc_path mds${MDSIDX} $OST) + local last_id=$(do_facet mds${MDSIDX} lctl get_param -n \ + osc.$mdtosc_proc1.prealloc_last_id) + local next_id=$(do_facet mds${MDSIDX} lctl get_param -n \ + osc.$mdtosc_proc1.prealloc_next_id) - do_facet mds${MDSIDX} lctl get_param osc.*OST*-osc-${MDT_INDEX}.prealloc* + local mdtosc_proc2=$(get_mdtosc_proc_path mds${MDSIDX}) + do_facet mds${MDSIDX} lctl get_param osc.$mdtosc_proc2.prealloc* mkdir -p $DIR/$tdir/${OST} $SETSTRIPE $DIR/$tdir/${OST} -i $OSTIDX -c 1 @@ -1025,7 +1029,7 @@ exhaust_precreations() { do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=0x215 echo "Creating to objid $last_id on ost $OST..." createmany -o $DIR/$tdir/${OST}/f $next_id $((last_id - next_id + 2)) - do_facet mds${MDSIDX} lctl get_param osc.*OST*-osc-${MDT_INDEX}.prealloc* + do_facet mds${MDSIDX} lctl get_param osc.$mdtosc_proc2.prealloc* do_facet ost$((OSTIDX + 1)) lctl set_param fail_loc=$FAILLOC sleep_maxage } @@ -1238,8 +1242,11 @@ test_27y() { [ "$OSTCOUNT" -lt "2" ] && skip_env "$OSTCOUNT < 2 OSTs -- skipping" && return remote_mds_nodsh && skip "remote MDS with nodsh" && return - local last_id=$(do_facet $SINGLEMDS lctl get_param -n osc.*0000-osc-MDT0000.prealloc_last_id) - local next_id=$(do_facet $SINGLEMDS lctl get_param -n osc.*0000-osc-MDT0000.prealloc_next_id) + local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS $FSNAME-OST0000) + local last_id=$(do_facet $SINGLEMDS lctl get_param -n \ + osc.$mdtosc.prealloc_last_id) + local next_id=$(do_facet $SINGLEMDS lctl get_param -n \ + osc.$mdtosc.prealloc_next_id) local fcount=$((last_id - next_id)) [ $fcount -eq 0 ] && skip "not enough space on OST0" && return [ $fcount -gt $OSTCOUNT ] && fcount=$OSTCOUNT @@ -2973,7 +2980,8 @@ test_53() { local ostnum # only test MDT0000 - for value in $(do_facet $SINGLEMDS lctl get_param osc.*-osc-MDT0000.prealloc_last_id) ; do + local mdtosc=$(get_mdtosc_proc_path $SINGLEMDS) + for value in $(do_facet $SINGLEMDS lctl get_param osc.$mdtosc.prealloc_last_id) ; do param=`echo ${value[0]} | cut -d "=" -f1` ostname=`echo $param | cut -d "." -f2 | cut -d - -f 1-2` mds_last=$(do_facet $SINGLEMDS lctl get_param -n $param) diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index e81b786..ce44564 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1939,12 +1939,11 @@ init_facets_vars () { osc_ensure_active () { local facet=$1 - local type=$2 - local timeout=$3 + local timeout=$2 local period=0 while [ $period -lt $timeout ]; do - count=$(do_facet $facet "lctl dl | grep '${FSNAME}-OST.*-osc-${type}' | grep ' IN ' 2>/dev/null | wc -l") + count=$(do_facet $facet "lctl dl | grep ' IN osc ' 2>/dev/null | wc -l") if [ $count -eq 0 ]; then break fi @@ -1969,8 +1968,8 @@ init_param_vars () { log "Using TIMEOUT=$TIMEOUT" - osc_ensure_active $SINGLEMDS M $TIMEOUT - osc_ensure_active client c $TIMEOUT + osc_ensure_active $SINGLEMDS $TIMEOUT + osc_ensure_active client $TIMEOUT if [ $QUOTA_AUTO -ne 0 ]; then if [ "$ENABLE_QUOTA" ]; then @@ -3414,28 +3413,52 @@ get_clientosc_proc_path() { } get_lustre_version () { - local node=${1:-"mds"} - do_facet $node $LCTL get_param -n version | awk '/^lustre:/ {print $2}' + local facet=${1:-"$SINGLEMDS"} + do_facet $facet $LCTL get_param -n version | awk '/^lustre:/ {print $2}' } get_mds_version_major () { - local version=$(get_lustre_version mds) + local facet=${1:-"$SINGLEMDS"} + local version=$(get_lustre_version $facet) echo $version | awk -F. '{print $1}' } get_mds_version_minor () { - local version=$(get_lustre_version mds) + local facet=${1:-"$SINGLEMDS"} + local version=$(get_lustre_version $facet) echo $version | awk -F. '{print $2}' } +# If the 2.0 MDS was mounted on 1.8 device, then the OSC and LOV names +# used by MDT would not be changed. +# mdt lov: fsname-mdtlov +# mdt osc: fsname-OSTXXXX-osc +mds_on_old_device() { + local mds=${1:-"$SINGLEMDS"} + local major=$(get_mds_version_major $mds) + local minor=$(get_mds_version_minor $mds) + + if [ $major -ge 2 ] || [ $major -eq 1 -a $minor -gt 8 ]; then + do_facet $mds "lctl list_param osc.$FSNAME-OST*-osc \ + > /dev/null 2>&1" && return 0 + fi + return 1 +} + get_mdtosc_proc_path() { - local ost=$1 - local major=$(get_mds_version_major) - local minor=$(get_mds_version_minor) - if [ $major -le 1 -a $minor -le 8 ] ; then - echo "${ost}-osc" + local mds_facet=$1 + local ost_label=${2:-"*OST*"} + + [ "$mds_facet" = "mds" ] && mds_facet=$SINGLEMDS + local mdt_label=$(convert_facet2label $mds_facet) + local mdt_index=$(echo $mdt_label | sed -e 's/^.*-//') + + local major=$(get_mds_version_major $mds_facet) + local minor=$(get_mds_version_minor $mds_facet) + if [ $major -le 1 -a $minor -le 8 ] || mds_on_old_device $mds_facet; then + echo "${ost_label}-osc" else - echo "${ost}-osc-MDT0000" + echo "${ost_label}-osc-${mdt_index}" fi } @@ -3444,8 +3467,8 @@ get_osc_import_name() { local ost=$2 local label=$(convert_facet2label $ost) - if [ "$facet" == "mds" ]; then - get_mdtosc_proc_path $label + if [ "${facet:0:3}" = "mds" ]; then + get_mdtosc_proc_path $facet $label return 0 fi @@ -3907,9 +3930,13 @@ flvr_cnt_mdt2ost() { local flavor=$1 local cnt=0 + local mdtosc for num in `seq $MDSCOUNT`; do - output=`do_facet mds$num lctl get_param -n osc.*OST*-osc-MDT*.$PROC_CLI 2>/dev/null` + mdtosc=$(get_mdtosc_proc_path mds$num) + mdtosc=${mdtosc/-MDT*/-MDT\*} + output=$(do_facet mds$num lctl get_param -n \ + osc.$mdtosc.$PROC_CLI 2>/dev/null) tmpcnt=`count_flvr "$output" $flavor` cnt=$((cnt + tmpcnt)) done