From 3e4061862e751dbbbbba273403b56201e705a830 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Mon, 28 Nov 2011 09:26:41 -0500 Subject: [PATCH] LU-864 test: Hostname name doesn't equal NID and use facet_mntpt On our test systems the hostname of the servers is on the ethernet fabric and for lustre we use infiniband separately. Currently several test will not run because of the assumption that lustre will use the same fabric and we use to login and manage the server. This patch allows one to grab the real NIDs instead of assuming its "hostname"@NETTYPE. The second part of the patch removes using $MOUNT% directly and uses facet_mntpt. The reason being is on our system the mount points are different on our servers from our clients. MOUNT is assumed to be the same for clients and the servers. This patch allows test to work if that is not the case. Signed-off-by: James Simmons Change-Id: I49f365561e341d44ace4c961fcae8b871dce7407 Reviewed-on: http://review.whamcloud.com/248 Tested-by: Hudson Reviewed-by: Yu Jian Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/tests/conf-sanity.sh | 2 +- lustre/tests/lnet-selftest.sh | 6 ++++-- lustre/tests/obdfilter-survey.sh | 6 ++++-- lustre/tests/sanity.sh | 16 +++++++++------- lustre/tests/test-framework.sh | 16 ++++++++++++++-- 5 files changed, 32 insertions(+), 14 deletions(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index fc6ec98..15e81ee 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -2418,7 +2418,7 @@ test_52() { [ $? -eq 0 ] || { error "Unable to mount client"; return 3; } local nrfiles=8 - local ost1mnt=${MOUNT%/*}/ost1 + local ost1mnt=$(facet_mntpt ost1) local ost1node=$(facet_active_host ost1) local ost1tmp=$TMP/conf52 diff --git a/lustre/tests/lnet-selftest.sh b/lustre/tests/lnet-selftest.sh index 06d3b57..860aa92 100755 --- a/lustre/tests/lnet-selftest.sh +++ b/lustre/tests/lnet-selftest.sh @@ -4,6 +4,7 @@ LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)} . $LUSTRE/tests/test-framework.sh init_test_env $@ . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} +init_logging # ALWAYS_EXCEPT="$ALWAYS_EXCEPT $LNET_SELFTEST_EXCEPT" @@ -25,8 +26,9 @@ if [ "$SLOW" = no ]; then [ $smoke_DURATION -le 300 ] || smoke_DURATION=300 fi -lst_SERVERS=${lst_SERVERS:-$(comma_list $(osts_nodes) $(mdts_nodes))} -lst_CLIENTS=${lst_CLIENTS:-${CLIENTS:-`hostname`}} +nodes=$(comma_list "$(osts_nodes) $(mdts_nodes)") +lst_SERVERS=${lst_SERVERS:-$(comma_list "$(host_nids_address $nodes $NETTYPE)")} +lst_CLIENTS=${lst_CLIENTS:-$(comma_list "$(host_nids_address $CLIENTS $NETTYPE)")} is_mounted () { local mntpt=$1 diff --git a/lustre/tests/obdfilter-survey.sh b/lustre/tests/obdfilter-survey.sh index 1e1284b..ea1af2e 100644 --- a/lustre/tests/obdfilter-survey.sh +++ b/lustre/tests/obdfilter-survey.sh @@ -36,14 +36,16 @@ fi get_targets () { local targets local devs + local nid local oss for oss in $(osts_nodes); do devs=$(do_node $oss "lctl dl |grep obdfilter |sort" | awk '{print $4}') + nid=$(host_nids_address $oss $NETTYPE) for d in $devs; do # if oss is local -- obdfilter-survey needs dev wo/ host target=$d - [[ $oss = `hostname` ]] || target=$oss:$target + [[ $oss = `hostname` ]] || target=$nid:$target targets="$targets $target" done done @@ -58,7 +60,7 @@ obdflter_survey_targets () { case $case in disk) targets=$(get_targets);; netdisk) targets=$(get_targets);; - network) targets="$(osts_nodes)";; + network) targets=$(host_nids_address $(comma_list $(osts_nodes)) $NETTYPE);; *) error "unknown obdflter-survey case!" ;; esac echo $targets diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index e992507..c50b040 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1353,8 +1353,7 @@ check_seq_oid() local objid=${lmm[$((j+1))]} local group=${lmm[$((j+3))]} local dev=$(ostdevname $devnum) - local dir=${MOUNT%/*}/ost$devnum - local mntpt=$(facet_mntpt ost$devnum) + local dir=$(facet_mntpt ost$devnum) stop ost$devnum do_facet ost$devnum mount -t $FSTYPE $dev $dir $OST_MOUNT_OPTS || @@ -1374,7 +1373,7 @@ check_seq_oid() [ $stripe -eq $i ] || { error "stripe mismatch"; return 6; } echo -e "\t\tost $obdidx, objid $objid, group $group" - do_facet ost$devnum umount -d $mntpt + do_facet ost$devnum umount -d $dir start ost$devnum $dev $OST_MOUNT_OPTS done } @@ -8225,12 +8224,15 @@ run_test 216 "check lockless direct write works and updates file size and kms co test_217() { # bug 22430 local node + local nid + for node in $(nodes_list); do - if [[ $node = *-* ]] ; then - echo "lctl ping $node@$NETTYPE" - lctl ping $node@$NETTYPE + nid=$(host_nids_address $node $NETTYPE) + if [[ $nid = *-* ]] ; then + echo "lctl ping $nid@$NETTYPE" + lctl ping $nid@$NETTYPE else - echo "skipping $node (no hiphen detected)" + echo "skipping $node (no hyphen detected)" fi done } diff --git a/lustre/tests/test-framework.sh b/lustre/tests/test-framework.sh index aacc64b..0e5fa31 100644 --- a/lustre/tests/test-framework.sh +++ b/lustre/tests/test-framework.sh @@ -1615,6 +1615,18 @@ do_lmc() { exit 1 } +host_nids_address() { + local nodes=$1 + local kind=$2 + + if [ -n "$kind" ]; then + nids=$(do_nodes $nodes "$LCTL list_nids | grep $kind | cut -f 1 -d '@'") + else + nids=$(do_nodes $nodes "$LCTL list_nids all | cut -f 1 -d '@'") + fi + echo $nids +} + h2name_or_ip() { if [ "$1" = "client" -o "$1" = "'*'" ]; then echo \'*\'; else echo $1"@$2" @@ -4590,7 +4602,7 @@ remove_mdt_files() { local mdtdev=$2 shift 2 local files="$@" - local mntpt=${MOUNT%/*}/$facet + local mntpt=$(facet_mntpt $facet) echo "removing files from $mdtdev on $facet: $files" mount -t $FSTYPE $MDS_MOUNT_OPTS $mdtdev $mntpt || return $? @@ -4607,7 +4619,7 @@ duplicate_mdt_files() { local mdtdev=$2 shift 2 local files="$@" - local mntpt=${MOUNT%/*}/$facet + local mntpt=$(facet_mntpt $facet) echo "duplicating files on $mdtdev on $facet: $files" mkdir -p $mntpt || return $? -- 1.8.3.1