From 8223d0cd86502fe3237d7d1a573eb5f6dd3061bf Mon Sep 17 00:00:00 2001 From: grev Date: Tue, 11 Nov 2008 12:22:31 +0000 Subject: [PATCH] b=16551 i=Adilger re-vert previous patch (have no permissions yet) --- lustre/tests/conf-sanity.sh | 175 +++++++++++++++----------------------------- 1 file changed, 61 insertions(+), 114 deletions(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 49bd61e..2aa9a71 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -755,29 +755,6 @@ test_26() { } run_test 26 "MDT startup failure cleans LOV (should return errs)" -wait_update () { - local node=$1 - local TEST=$2 - local FINAL=$3 - - local RESULT - local MAX=90 - local WAIT=0 - local sleep=5 - while [ $WAIT -lt $MAX ]; do - RESULT=$(do_node $node "$TEST") - if [ $RESULT -eq $FINAL ]; then - echo "Updated config after $WAIT sec: wanted $FINAL got $RESULT" - return 0 - fi - WAIT=$((WAIT + sleep)) - echo "Waiting $((MAX - WAIT)) secs for config update" - sleep $sleep - done - echo "Config update not seen after $MAX sec: wanted $FINAL got $RESULT" - return 3 -} - set_and_check() { local myfacet=$1 local TEST=$2 @@ -791,8 +768,23 @@ set_and_check() { fi echo "Setting $PARAM from $ORIG to $FINAL" do_facet mds "$LCTL conf_param $PARAM=$FINAL" || error conf_param failed - - wait_update $(facet_host $myfacet) "$TEST" $FINAL || error check failed! + local RESULT + local MAX=90 + local WAIT=0 + while [ 1 ]; do + sleep 5 + RESULT=$(do_facet $myfacet "$TEST") + if [ $RESULT -eq $FINAL ]; then + echo "Updated config after $WAIT sec (got $RESULT)" + break + fi + WAIT=$((WAIT + 5)) + if [ $WAIT -eq $MAX ]; then + echo "Config update not seen: wanted $FINAL got $RESULT" + return 3 + fi + echo "Waiting $(($MAX - $WAIT)) secs for config update" + done } test_27a() { @@ -930,55 +922,18 @@ test_31() { # bug 10734 } run_test 31 "Connect to non-existent node (returns errors, should not crash)" -# Use these start32/stop32 fn instead of t-f start/stop fn, -# for local devices, to skip global facet vars init -stop32 () { - local facet=$1 - shift - echo "Stopping local ${MOUNT%/*}/${facet} (opts:$@)" - umount -d $@ ${MOUNT%/*}/${facet} - losetup -a -} - -start32 () { - local facet=$1 - shift - local device=$1 - shift - mkdir -p ${MOUNT%/*}/${facet} - - echo "Starting local ${facet}: $@ $device ${MOUNT%/*}/${facet}" - mount -t lustre $@ ${device} ${MOUNT%/*}/${facet} - RC=$? - if [ $RC -ne 0 ]; then - echo "mount -t lustre $@ ${device} ${MOUNT%/*}/${facet}" - echo "Start of ${device} of local ${facet} failed ${RC}" - fi - losetup -a - return $RC -} - -cleanup_nocli32 () { - stop32 mds -f - stop32 ost1 -f - wait_exit_ST client -} - -cleanup_32() { - trap 0 - echo "Cleanup test_32 umount $MOUNT ..." - umount -f $MOUNT || true - echo "Cleanup local mds ost1 ..." - cleanup_nocli32 - unload_modules -} - test_32a() { - # this test is totally useless on a client-only system - [ -n "$CLIENTONLY" -o -n "$CLIENTMODSONLY" ] && skip "client only testing" && return 0 + # XXX - make this run on client-only systems with real hardware on + # the OST and MDT + # there appears to be a lot of assumption here about loopback + # devices + # or maybe this test is just totally useless on a client-only system [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; } - [ -z "$TUNEFS" ] && skip "No tunefs" && return 0 + [ "$mds_HOST" = "`hostname`" ] || { skip "remote MDS" && return 0; } + [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \ + { skip "remote OST" && return 0; } + [ -z "$TUNEFS" ] && skip "No tunefs" && return local DISK1_4=$LUSTRE/tests/disk1_4.zip [ ! -r $DISK1_4 ] && skip "Cant find $DISK1_4, skipping" && return @@ -988,17 +943,14 @@ test_32a() { lctl set_param debug=$PTLDEBUG $TUNEFS $tmpdir/mds || error "tunefs failed" - # nids are wrong, so client wont work, but server should start - start32 mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" && \ - trap cleanup_32 EXIT INT || return 3 - - local UUID=$(lctl get_param -n mds.lustre-MDT0000.uuid) + start mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" || return 3 + local UUID=$(lctl get_param -n mds.lustre-MDT0000.uuid) echo MDS uuid $UUID [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID" $TUNEFS --mgsnode=`hostname` $tmpdir/ost1 || error "tunefs failed" - start32 ost1 $tmpdir/ost1 "-o loop" || return 5 + start ost1 $tmpdir/ost1 "-o loop" || return 5 UUID=$(lctl get_param -n obdfilter.lustre-OST0000.uuid) echo OST uuid $UUID [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID" @@ -1016,37 +968,40 @@ test_32a() { # With a new good MDT failover nid, we should be able to mount a client # (but it cant talk to OST) - local mountopt="-o exclude=lustre-OST0000" - - local device=`h2$NETTYPE $HOSTNAME`:/lustre - echo "Starting local client: $HOSTNAME: $mountopt $device $MOUNT" - mount -t lustre $mountopt $device $MOUNT || return 1 - - local old=$(lctl get_param -n mdc.*.max_rpcs_in_flight) - local new=$((old + 5)) - lctl conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=$new - wait_update $HOSTNAME "lctl get_param -n mdc.*.max_rpcs_in_flight" $new || return 11 + local OLDMOUNTOPT=$MOUNTOPT + MOUNTOPT="exclude=lustre-OST0000" + mount_client $MOUNT + MOUNTOPT=$OLDMOUNTOPT + set_and_check client "lctl get_param -n mdc.*.max_rpcs_in_flight" "lustre-MDT0000.mdc.max_rpcs_in_flight" || + return 11 - cleanup_32 + zconf_umount `hostname` $MOUNT -f + cleanup_nocli + load_modules - # mount a second time to make sure we didnt leave upgrade flag on + # mount a second time to make sure we didnt leave upgrade flag on load_modules $TUNEFS --dryrun $tmpdir/mds || error "tunefs failed" - start32 mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" && \ - trap cleanup_32 EXIT INT || return 12 - - cleanup_32 + load_modules + start mds $tmpdir/mds "-o loop,exclude=lustre-OST0000" || return 12 + cleanup_nocli rm -rf $tmpdir || true # true is only for TMP on NFS } run_test 32a "Upgrade from 1.4 (not live)" test_32b() { - # this test is totally useless on a client-only system - [ -n "$CLIENTONLY" -o -n "$CLIENTMODSONLY" ] && skip "client only testing" && return 0 - [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; } - [ -z "$TUNEFS" ] && skip "No tunefs" && return + # XXX - make this run on client-only systems with real hardware on + # the OST and MDT + # there appears to be a lot of assumption here about loopback + # devices + # or maybe this test is just totally useless on a client-only system + [ "$NETTYPE" = "tcp" ] || { skip "NETTYPE != tcp" && return 0; } + [ "$mds_HOST" = "`hostname`" ] || { skip "remote MDS" && return 0; } + [ "$ost_HOST" = "`hostname`" -o "$ost1_HOST" = "`hostname`" ] || \ + { skip "remote OST" && return 0; } + [ -z "$TUNEFS" ] && skip "No tunefs" && return local DISK1_4=$LUSTRE/tests/disk1_4.zip [ ! -r $DISK1_4 ] && skip "Cant find $DISK1_4, skipping" && return @@ -1054,19 +1009,17 @@ test_32b() { unzip -o -j -d $tmpdir $DISK1_4 || { skip "Cant unzip $DISK1_4, skipping" && return ; } load_modules lctl set_param debug=$PTLDEBUG - local NEWNAME=sofia + NEWNAME=sofia # writeconf will cause servers to register with their current nids $TUNEFS --writeconf --fsname=$NEWNAME $tmpdir/mds || error "tunefs failed" - start32 mds $tmpdir/mds "-o loop" && \ - trap cleanup_32 EXIT INT || return 3 - + start mds $tmpdir/mds "-o loop" || return 3 local UUID=$(lctl get_param -n mds.${NEWNAME}-MDT0000.uuid) echo MDS uuid $UUID [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID" $TUNEFS --mgsnode=`hostname` --fsname=$NEWNAME --writeconf $tmpdir/ost1 || error "tunefs failed" - start32 ost1 $tmpdir/ost1 "-o loop" || return 5 + start ost1 $tmpdir/ost1 "-o loop" || return 5 UUID=$(lctl get_param -n obdfilter.${NEWNAME}-OST0000.uuid) echo OST uuid $UUID [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID" @@ -1082,21 +1035,15 @@ test_32b() { # MDT and OST should have registered with new nids, so we should have # a fully-functioning client echo "Check client and old fs contents" - - local device=`h2$NETTYPE $HOSTNAME`:/$NEWNAME - echo "Starting local client: $HOSTNAME: $device $MOUNT" - mount -t lustre $device $MOUNT || return 1 - - local old=$(lctl get_param -n mdc.*.max_rpcs_in_flight) - local new=$((old + 5)) - lctl conf_param ${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight=$new - wait_update $HOSTNAME "lctl get_param -n mdc.*.max_rpcs_in_flight" $new || return 11 - + OLDFS=$FSNAME + FSNAME=$NEWNAME + mount_client $MOUNT + FSNAME=$OLDFS + set_and_check client "lctl get_param -n mdc.*.max_rpcs_in_flight" "${NEWNAME}-MDT0000.mdc.max_rpcs_in_flight" || return 11 [ "$(cksum $MOUNT/passwd | cut -d' ' -f 1,2)" == "2479747619 779" ] || return 12 echo "ok." - cleanup_32 - + cleanup rm -rf $tmpdir || true # true is only for TMP on NFS } run_test 32b "Upgrade from 1.4 with writeconf" -- 1.8.3.1