From: Li Wei Date: Fri, 4 Jan 2013 03:55:18 +0000 (+0800) Subject: LU-2563 tests: Print correct names in mgsdevname() X-Git-Tag: 2.3.60~45 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=99baa15238372186cb9b02dca6aff7e3852c65b5 LU-2563 tests: Print correct names in mgsdevname() Current mgsdevname() prints names of block devices (or files for loop devices) regardless of MGS back end types. This is plainly a violation of what the function is expected to do. If an MGS is ZFS-based, mgsdevname() should print the dataset name instead of the VDev names. This patch fixes the regression and makes sure that mgsdevname() and mgsvdevname() work for both standalone and MDT-combined MGSs. Signed-off-by: Li Wei Change-Id: I5885af48e811fcd98aa00c5d901db30e5837b505 Signed-off-by: Li Wei Reviewed-on: http://review.whamcloud.com/4950 Tested-by: Hudson Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-by: wangdi Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index f47f3ab..6aad0c4 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -732,6 +732,11 @@ facet_fstype() { return fi + if [[ $facet == mgs ]] && combined_mgs_mds; then + facet_fstype mds1 + return + fi + return 1 } @@ -2669,37 +2674,50 @@ mdsvdevname() { } mgsdevname() { - local DEVNAME=MGSDEV - local MDSDEV1=$(mdsdevname 1) - - local fstype=$(facet_fstype mds1) + local DEVPTR + local fstype=$(facet_fstype mgs) case $fstype in - ldiskfs|zfs ) - #if $MGSDEV isn't defined, default is $MDSDEV1 - #ZFS independent mgsdev should be ${FSNAME}-mgs/mgs - eval DEVPTR=${!DEVNAME:=${MDSDEV1}};; - * ) - error "unknown fstype!";; + ldiskfs ) + if [ $(facet_host mgs) = $(facet_host mds1) ] && + ( [ -z "$MGSDEV" ] || [ $MGSDEV = $(mdsdevname 1) ] ); then + DEVPTR=$(mdsdevname 1) + else + DEVPTR=$MGSDEV + fi;; + zfs ) + if [ $(facet_host mgs) = $(facet_host mds1) ] && + ( [ -z "$MGSDEV" ] || [ $MGSDEV = $(mdsvdevname 1) ] ); then + DEVPTR=$(mdsdevname 1) + else + DEVPTR=${FSNAME}-mgs/mgs + fi;; + * ) + error "unknown fstype!";; esac - echo -n $DEVPTR + echo -n $DEVPTR } mgsvdevname() { + local VDEVPTR DEVNAME=MGSDEV - local fstype=$(facet_fstype mds1) + local fstype=$(facet_fstype mgs) case $fstype in - ldiskfs ) - # vdevs are not supported by ldiskfs - eval VDEVPTR="";; - zfs ) - #if $MGSDEV isn't defined, default is $MGSDEV1 - eval VDEVPTR=${!DEVNAME:=${MDSDEV1}};; - * ) - error "unknown fstype!";; + ldiskfs ) + # vdevs are not supported by ldiskfs + ;; + zfs ) + if [ $(facet_host mgs) = $(facet_host mds1) ] && + ( [ -z "$MGSDEV" ] || [ $MGSDEV = $(mdsvdevname 1) ] ); then + VDEVPTR=$(mdsvdevname 1) + else + VDEVPTR=$MGSDEV + fi;; + * ) + error "unknown fstype!";; esac echo -n $VDEVPTR