3 # add uml1 uml2 uml3 in your /etc/hosts
5 # FIXME - there is no reason to use all of these different
6 # return codes, espcially when most of them are mapped to something
7 # else anyway. The combination of test number and return code
8 # figure out what failed.
14 # These tests don't apply to mountconf
15 MOUNTCONFSKIP="9 10 11 12 13 13b 14 15 18"
17 # bug number for skipped test:
18 ALWAYS_EXCEPT=" $CONF_SANITY_EXCEPT $MOUNTCONFSKIP 16 23"
19 # UPDATE THE COMMENT ABOVE WITH BUG NUMBERS WHEN CHANGING ALWAYS_EXCEPT!
22 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
24 PTLDEBUG=${PTLDEBUG:--1}
25 LUSTRE=${LUSTRE:-`dirname $0`/..}
26 RLUSTRE=${RLUSTRE:-$LUSTRE}
27 MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre}
28 MKFSLUSTRE=${MKFSLUSTRE:-/usr/sbin/mkfs.lustre}
31 . $LUSTRE/tests/test-framework.sh
33 . ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
44 # who knows if/where $TUNEFS is installed? Better reformat if it fails...
45 do_facet ${facet} "$TUNEFS --writeconf $MDSDEV" || echo "tunefs failed, reformatting instead" && reformat
50 # The MGS must be started before the OSTs for a new fs, so start
51 # and stop to generate the startup logs.
60 echo "start mds service on `facet_active_host mds`"
61 start mds $MDSDEV $MDS_MOUNT_OPTS || return 94
65 echo "stop mds service on `facet_active_host mds`"
66 # These tests all use non-failover stop
67 stop mds -f || return 97
71 echo "start ost1 service on `facet_active_host ost1`"
72 start ost1 `ostdevname 1` $OST_MOUNT_OPTS || return 95
76 echo "stop ost1 service on `facet_active_host ost1`"
77 # These tests all use non-failover stop
78 stop ost1 -f || return 98
82 echo "start ost2 service on `facet_active_host ost2`"
83 start ost2 `ostdevname 2` $OST_MOUNT_OPTS || return 92
87 echo "stop ost2 service on `facet_active_host ost2`"
88 # These tests all use non-failover stop
89 stop ost2 -f || return 93
94 echo "mount $FSNAME on ${MOUNTPATH}....."
95 zconf_mount `hostname` $MOUNTPATH || return 96
99 local SAVEMOUNTOPT=$MOUNTOPT
100 MOUNTOPT="remount,$1"
102 echo "remount '$1' lustre on ${MOUNTPATH}....."
103 zconf_mount `hostname` $MOUNTPATH || return 96
104 MOUNTOPT=$SAVEMOUNTOPT
109 echo "umount lustre on ${MOUNTPATH}....."
110 zconf_umount `hostname` $MOUNTPATH || return 97
113 manual_umount_client(){
114 echo "manual umount lustre on ${MOUNT}...."
115 do_facet client "umount -d $MOUNT"
125 stop_mds || return 201
126 stop_ost || return 202
127 unload_modules || return 203
131 umount_client $MOUNT || return 200
132 cleanup_nocli || return $?
136 do_facet client "cp /etc/passwd $DIR/a" || return 71
137 do_facet client "rm $DIR/a" || return 72
138 # make sure lustre is actually mounted (touch will block,
139 # but grep won't, so do it after)
140 do_facet client "grep $MOUNT' ' /proc/mounts > /dev/null" || return 73
141 echo "setup single mount lustre success"
145 do_facet client "touch $DIR/a" || return 71
146 do_facet client "rm $DIR/a" || return 72
147 do_facet client "touch $DIR2/a" || return 73
148 do_facet client "rm $DIR2/a" || return 74
149 echo "setup double mount lustre success"
154 if [ "$ONLY" == "setup" ]; then
159 if [ "$ONLY" == "cleanup" ]; then
164 #create single point mountpoint
172 check_mount || return 41
175 run_test 0 "single mount setup"
179 echo "start ost second time..."
181 check_mount || return 42
184 run_test 1 "start up ost twice (should return errors)"
189 echo "start mds second time.."
192 check_mount || return 43
195 run_test 2 "start up mds twice (should return err)"
199 #mount.lustre returns an error if already in mtab
200 mount_client $MOUNT && return $?
201 check_mount || return 44
204 run_test 3 "mount client twice (should return err)"
208 touch $DIR/$tfile || return 85
212 # ok for ost to fail shutdown
213 if [ 202 -ne $eno ]; then
218 run_test 4 "force cleanup ost, then cleanup"
222 touch $DIR/$tfile || return 1
223 stop_mds -f || return 2
225 # cleanup may return an error from the failed
226 # disconnects; for now I'll consider this successful
227 # if all the modules have unloaded.
231 echo "killing umount"
232 kill -TERM $UMOUNT_PID
233 echo "waiting for umount to finish"
235 if grep " $MOUNT " /etc/mtab; then
236 echo "test 5: mtab after failed umount"
240 echo "killing umount"
241 kill -TERM $UMOUNT_PID
242 echo "waiting for umount to finish"
244 grep " $MOUNT " /etc/mtab && echo "test 5: mtab after second umount" && return 11
248 # stop_mds is a no-op here, and should not fail
249 cleanup_nocli || return $?
250 # df may have lingering entry
252 # mtab may have lingering entry
253 grep -v $MOUNT" " /etc/mtab > $TMP/mtabtemp
254 mv $TMP/mtabtemp /etc/mtab
256 run_test 5 "force cleanup mds, then cleanup"
260 [ -d $MOUNT ] || mkdir -p $MOUNT
261 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab before mount" && return 10
262 mount_client $MOUNT && return 1
263 grep " $MOUNT " /etc/mtab && echo "test 5b: mtab after failed mount" && return 11
265 # stop_mds is a no-op here, and should not fail
266 cleanup_nocli || return $?
269 run_test 5b "mds down, cleanup after failed mount (bug 2712) (should return errs)"
274 [ -d $MOUNT ] || mkdir -p $MOUNT
275 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab before mount" && return 10
276 mount -t lustre $MGSNID:/wrong.$FSNAME $MOUNT || :
277 grep " $MOUNT " /etc/mtab && echo "test 5c: mtab after failed mount" && return 11
279 cleanup_nocli || return $?
281 run_test 5c "cleanup after failed mount (bug 2712) (should return errs)"
287 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab before mount" && return 10
288 mount_client $MOUNT || return 1
290 grep " $MOUNT " /etc/mtab && echo "test 5d: mtab after unmount" && return 11
293 run_test 5d "mount with ost down"
298 # give MDS a chance to connect to OSTs (bz 10476)
301 #define OBD_FAIL_PTLRPC_DELAY_SEND 0x506
302 do_facet client "sysctl -w lustre.fail_loc=0x80000506"
303 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab before mount" && return 10
304 mount_client $MOUNT || echo "mount failed (not fatal)"
306 grep " $MOUNT " /etc/mtab && echo "test 5e: mtab after unmount" && return 11
309 run_test 5e "delayed connect, don't crash (bug 10268)"
314 mount_client ${MOUNT} || return 87
315 touch $DIR/a || return 86
318 run_test 6 "manual umount, then mount again"
323 cleanup_nocli || return $?
325 run_test 7 "manual umount, then cleanup"
330 check_mount2 || return 45
331 umount_client $MOUNT2
334 run_test 8 "double mount setup"
339 do_facet ost1 sysctl lnet.debug=\'inode trace\' || return 1
340 do_facet ost1 sysctl lnet.subsystem_debug=\'mds ost\' || return 1
342 CHECK_PTLDEBUG="`do_facet ost1 sysctl -n lnet.debug`"
343 if [ "$CHECK_PTLDEBUG" ] && [ "$CHECK_PTLDEBUG" = "trace inode" ];then
344 echo "lnet.debug success"
346 echo "lnet.debug: want 'trace inode', have '$CHECK_PTLDEBUG'"
349 CHECK_SUBSYS="`do_facet ost1 sysctl -n lnet.subsystem_debug`"
350 if [ "$CHECK_SUBSYS" ] && [ "$CHECK_SUBSYS" = "mds ost" ]; then
351 echo "lnet.subsystem_debug success"
353 echo "lnet.subsystem_debug: want 'mds ost', have '$CHECK_SUBSYS'"
356 stop_ost || return $?
359 run_test 9 "test ptldebug and subsystem for mkfs"
362 echo "generate configuration with the same name for node and mds"
363 OLDXMLCONFIG=$XMLCONFIG
364 XMLCONFIG="broken.xml"
365 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
369 echo "the name for node and mds is the same"
370 do_lmc --add mds --node ${facet}_facet --mds ${facet}_facet \
371 --dev $MDSDEV --size $MDSSIZE || return $?
372 do_lmc --add lov --mds ${facet}_facet --lov lov1 --stripe_sz \
373 $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ \
374 --stripe_pattern 0 || return $?
375 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
377 add_facet $facet --lustre_upcall $UPCALL
378 do_lmc --add mtpt --node ${facet}_facet --mds mds_facet \
379 --lov lov1 --path $MOUNT
385 check_mount || return 41
389 XMLCONFIG=$OLDXMLCONFIG
391 run_test 10 "mount lustre with the same name for node and mds"
394 OLDXMLCONFIG=$XMLCONFIG
395 XMLCONFIG="conf11.xml"
397 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
398 add_mds mds --dev $MDSDEV --size $MDSSIZE
399 add_ost ost --dev $OSTDEV --size $OSTSIZE
400 add_client client mds --path $MOUNT --ost ost_svc || return $?
401 echo "Default lov config success!"
403 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
404 add_mds mds --dev $MDSDEV --size $MDSSIZE
405 add_ost ost --dev $OSTDEV --size $OSTSIZE
406 add_client client mds --path $MOUNT && return $?
407 echo "--add mtpt with neither --lov nor --ost will return error"
411 XMLCONFIG=$OLDXMLCONFIG
413 run_test 11 "use default lov configuration (should return error)"
416 OLDXMLCONFIG=$XMLCONFIG
417 XMLCONFIG="batch.xml"
418 BATCHFILE="batchfile"
421 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
422 [ -f "$BATCHFILE" ] && rm -f $BATCHFILE
423 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
424 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions \"-I 128\"" >> $BATCHFILE
425 # --mkfsoptions "-I 128"
426 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
427 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
428 echo "matched double quote success"
430 echo "matched double quote fail"
435 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
436 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions \"-I 128" >> $BATCHFILE
437 # --mkfsoptions "-I 128
438 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
439 echo "unmatched double quote should return error"
443 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
444 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions '-I 128'" >> $BATCHFILE
445 # --mkfsoptions '-I 128'
446 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
447 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
448 echo "matched single quote success"
450 echo "matched single quote fail"
455 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
456 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions '-I 128" >> $BATCHFILE
457 # --mkfsoptions '-I 128
458 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
459 echo "unmatched single quote should return error"
463 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
464 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions \-\I\ \128" >> $BATCHFILE
465 # --mkfsoptions \-\I\ \128
466 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
467 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
468 echo "backslash followed by a whitespace/letter success"
470 echo "backslash followed by a whitespace/letter fail"
475 echo "--add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp" > $BATCHFILE
476 echo "--add mds --node $HOSTNAME --mds mds1 --mkfsoptions -I\ 128\\" >> $BATCHFILE
477 # --mkfsoptions -I\ 128\
478 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
479 echo "backslash followed by nothing should return error"
482 XMLCONFIG=$OLDXMLCONFIG
484 run_test 12 "lmc --batch, with single/double quote, backslash in batchfile"
487 OLDXMLCONFIG=$XMLCONFIG
488 XMLCONFIG="conf13-1.xml"
490 # check long uuid will be truncated properly and uniquely
491 echo "To generate XML configuration file(with long ost name): $XMLCONFIG"
492 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
493 do_lmc --add net --node $HOSTNAME --nid $HOSTNAME --nettype tcp
494 do_lmc --add mds --node $HOSTNAME --mds mds1_name_longer_than_31characters
495 do_lmc --add mds --node $HOSTNAME --mds mds2_name_longer_than_31characters
496 if [ ! -f "$XMLCONFIG" ]; then
497 echo "Error:no file $XMLCONFIG created!"
500 EXPECTEDMDS1UUID="e_longer_than_31characters_UUID"
501 EXPECTEDMDS2UUID="longer_than_31characters_UUID_2"
502 FOUNDMDS1UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '1p' \
503 | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
504 FOUNDMDS2UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '2p' \
505 | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
506 [ -z "$FOUNDMDS1UUID" ] && echo "MDS1 UUID empty" && return 1
507 [ -z "$FOUNDMDS2UUID" ] && echo "MDS2 UUID empty" && return 1
508 if ([ $EXPECTEDMDS1UUID = $FOUNDMDS1UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS2UUID ]) || \
509 ([ $EXPECTEDMDS1UUID = $FOUNDMDS2UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS1UUID ]); then
510 echo "Success:long uuid truncated successfully and being unique."
512 echo "Error:expected uuid for mds1 and mds2: $EXPECTEDMDS1UUID; $EXPECTEDMDS2UUID"
513 echo "but: found uuid for mds1 and mds2: $FOUNDMDS1UUID; $FOUNDMDS2UUID"
517 XMLCONFIG=$OLDXMLCONFIG
519 run_test 13 "check new_uuid of lmc operating correctly"
522 OLDXMLCONFIG=$XMLCONFIG
523 XMLCONFIG="conf13-1.xml"
524 SECONDXMLCONFIG="conf13-2.xml"
525 # check multiple invocations for lmc generate same XML configuration file
527 echo "Generate the first XML configuration file"
529 echo "mv $XMLCONFIG to $SECONDXMLCONFIG"
530 sed -e "s/mtime[^ ]*//" $XMLCONFIG > $SECONDXMLCONFIG || return $?
531 echo "Generate the second XML configuration file"
533 # don't compare .xml mtime, it will always be different
534 if [ `sed -e "s/mtime[^ ]*//" $XMLCONFIG | diff - $SECONDXMLCONFIG | wc -l` -eq 0 ]; then
535 echo "Success:multiple invocations for lmc generate same XML file"
537 echo "Error: multiple invocations for lmc generate different XML file"
541 rm -f $XMLCONFIG $SECONDXMLCONFIG
542 XMLCONFIG=$OLDXMLCONFIG
544 run_test 13b "check lmc generates consistent .xml file"
549 # create xml file with --mkfsoptions for ost
550 echo "create xml file with --mkfsoptions for ost"
551 add_mds mds --dev $MDSDEV --size $MDSSIZE
552 add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
553 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
554 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE \
555 --mkfsoptions "-Llabel_conf_14"
556 add_client client mds --lov lov1 --path $MOUNT
558 FOUNDSTRING=`awk -F"<" '/<mkfsoptions>/{print $2}' $XMLCONFIG`
559 EXPECTEDSTRING="mkfsoptions>-Llabel_conf_14"
560 if [ "$EXPECTEDSTRING" != "$FOUNDSTRING" ]; then
561 echo "Error: expected: $EXPECTEDSTRING; found: $FOUNDSTRING"
564 echo "Success:mkfsoptions for ost written to xml file correctly."
566 # mount lustre to test lconf mkfsoptions-parsing
570 mount_client $MOUNT || return $?
571 if [ -z "`do_facet ost1 dumpe2fs -h $OSTDEV | grep label_conf_14`" ]; then
572 echo "Error: the mkoptions not applied to mke2fs of ost."
576 echo "lconf mkfsoptions for ost success"
580 run_test 14 "test mkfsoptions of ost for lmc and lconf"
584 [ -f $MOUNTLUSTRE ] && echo "remove $MOUNTLUSTRE" && rm -f $MOUNTLUSTRE
585 if [ -f $MOUNTLUSTRE.sav ]; then
586 echo "return original $MOUNTLUSTRE.sav to $MOUNTLUSTRE"
587 mv $MOUNTLUSTRE.sav $MOUNTLUSTRE
591 # this only tests the kernel mount command, not anything about lustre.
593 MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre}
597 echo "mount lustre on ${MOUNT} without $MOUNTLUSTRE....."
598 if [ -f "$MOUNTLUSTRE" ]; then
599 echo "save $MOUNTLUSTRE to $MOUNTLUSTRE.sav"
600 mv $MOUNTLUSTRE $MOUNTLUSTRE.sav && trap cleanup_15 EXIT INT
601 if [ -f $MOUNTLUSTRE ]; then
602 echo "$MOUNTLUSTRE cannot be moved, skipping test"
607 mount_client $MOUNT && error "mount succeeded" && return 1
608 echo "mount lustre on $MOUNT without $MOUNTLUSTRE failed as expected"
612 run_test 15 "zconf-mount without /sbin/mount.lustre (should return error)"
615 TMPMTPT="${MOUNT%/*}/conf16"
617 if [ ! -f "$MDSDEV" ]; then
618 echo "no $MDSDEV existing, so mount Lustre to create one"
620 check_mount || return 41
624 echo "change the mode of $MDSDEV/OBJECTS,LOGS,PENDING to 555"
625 do_facet mds "mkdir -p $TMPMTPT &&
626 mount -o loop -t ext3 $MDSDEV $TMPMTPT &&
627 chmod 555 $TMPMTPT/{OBJECTS,LOGS,PENDING} &&
628 umount $TMPMTPT" || return $?
630 echo "mount Lustre to change the mode of OBJECTS/LOGS/PENDING, then umount Lustre"
632 check_mount || return 41
635 echo "read the mode of OBJECTS/LOGS/PENDING and check if they has been changed properly"
636 EXPECTEDOBJECTSMODE=`do_facet mds "debugfs -R 'stat OBJECTS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
637 EXPECTEDLOGSMODE=`do_facet mds "debugfs -R 'stat LOGS' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
638 EXPECTEDPENDINGMODE=`do_facet mds "debugfs -R 'stat PENDING' $MDSDEV 2> /dev/null" | grep 'Mode: ' | sed -e "s/.*Mode: *//" -e "s/ *Flags:.*//"`
640 if [ "$EXPECTEDOBJECTSMODE" = "0777" ]; then
641 echo "Success:Lustre change the mode of OBJECTS correctly"
643 echo "Error: Lustre does not change mode of OBJECTS properly"
647 if [ "$EXPECTEDLOGSMODE" = "0777" ]; then
648 echo "Success:Lustre change the mode of LOGS correctly"
650 echo "Error: Lustre does not change mode of LOGS properly"
654 if [ "$EXPECTEDPENDINGMODE" = "0777" ]; then
655 echo "Success:Lustre change the mode of PENDING correctly"
657 echo "Error: Lustre does not change mode of PENDING properly"
661 run_test 16 "verify that lustre will correct the mode of OBJECTS/LOGS/PENDING"
664 if [ ! -f "$MDSDEV" ]; then
665 echo "no $MDSDEV existing, so mount Lustre to create one"
667 check_mount || return 41
671 echo "Remove mds config log"
672 do_facet mds "debugfs -w -R 'unlink CONFIGS/$FSNAME-MDT0000' $MDSDEV || return \$?" || return $?
675 start_mds && return 42
678 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936) (should return errs)"
681 [ -f $MDSDEV ] && echo "remove $MDSDEV" && rm -f $MDSDEV
682 echo "mount mds with large journal..."
685 #FIXME have to change MDS_MKFS_OPTS
688 echo "mount lustre system..."
690 check_mount || return 41
692 echo "check journal size..."
693 FOUNDJOURNALSIZE=`do_facet mds "debugfs -R 'stat <8>' $MDSDEV" | awk '/Size: / { print $NF; exit;}'`
694 if [ "$FOUNDJOURNALSIZE" = "79691776" ]; then
695 echo "Success:lconf creates large journals"
697 echo "Error:lconf not create large journals correctly"
698 echo "expected journal size: 79691776(76M), found journal size: $FOUNDJOURNALSIZE"
707 run_test 18 "check lconf creates large journals"
710 start_mds || return 1
711 stop_mds -f || return 2
713 run_test 19a "start/stop MDS without OSTs"
716 start_ost || return 1
717 stop_ost -f || return 2
719 run_test 19b "start/stop OSTs without MDS"
722 # first format the ost/mdt
726 check_mount || return 43
728 remount_client ro $MOUNT || return 44
729 touch $DIR/$tfile && echo "$DIR/$tfile created incorrectly" && return 45
730 [ -e $DIR/$tfile ] && echo "$DIR/$tfile exists incorrectly" && return 46
731 remount_client rw $MOUNT || return 47
733 [ ! -f $DIR/$tfile ] && echo "$DIR/$tfile missing" && return 48
734 MCNT=`grep -c $MOUNT /etc/mtab`
735 [ "$MCNT" -ne 1 ] && echo "$MOUNT in /etc/mtab $MCNT times" && return 49
740 run_test 20 "remount ro,rw mounts work and doesn't break /etc/mtab"
748 run_test 21a "start mds before ost, stop ost first"
756 run_test 21b "start ost before mds, stop mds first"
766 run_test 21c "start mds between two osts, stop mds last"
769 #reformat to remove all logs
772 echo Client mount before any osts are in the logs
774 check_mount && return 41
777 echo Client mount with ost in logs, but none running
781 # check_mount will block trying to contact ost
785 echo Client mount with a running ost
789 check_mount || return 41
794 run_test 22 "start a client before osts (should return errs)"
800 # force down client so that recovering mds waits for reconnect
801 zconf_umount `hostname` $MOUNT -f
802 # enter recovery on mds
804 # try to start a new client
805 mount_client $MOUNT &
808 MOUNT_LUSTRE_PID=`ps -ef | grep mount.lustre | grep -v grep | awk '{print $2}'`
809 echo mount pid is ${MOUNT_PID}, mount.lustre pid is ${MOUNT_LUSTRE_PID}
811 ps --ppid $MOUNT_LUSTRE_PID
812 # FIXME why o why can't I kill these? Manual "ctrl-c" works...
813 kill -TERM $MOUNT_PID
814 echo "waiting for mount to finish"
821 #this test isn't working yet
822 #run_test 23 "interrupt client during recovery mount delay"
825 local fs2mds_HOST=$mds_HOST
826 # test 8-char fsname as well
827 local FSNAME2=test1234
828 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME2} --nomgs --mgsnode=$MGSNID --reformat ${MDSDEV}_2 || exit 10
830 local fs2ost_HOST=$ost_HOST
831 local fs2ostdev=$(ostdevname 1)_2
832 add fs2ost $OST_MKFS_OPTS --fsname=${FSNAME2} --reformat $fs2ostdev || exit 10
835 start fs2mds ${MDSDEV}_2 $MDS_MOUNT_OPTS
836 start fs2ost $fs2ostdev $OST_MOUNT_OPTS
838 mount -t lustre $MGSNID:/${FSNAME2} $MOUNT2 || return 1
840 check_mount || return 2
841 # files written on 1 should not show up on 2
842 cp /etc/passwd $DIR/$tfile
844 [ -e $MOUNT2/$tfile ] && error "File bleed" && return 7
847 cp /etc/passwd $MOUNT2/b || return 3
848 rm $MOUNT2/b || return 4
849 # 2 is actually mounted
850 grep $MOUNT2' ' /proc/mounts > /dev/null || return 5
852 facet_failover fs2mds
853 facet_failover fs2ost
856 # the MDS must remain up until last MDT
858 MDS=$(awk '($3 ~ "mdt" && $4 ~ "MDT") { print $4 }' $LPROC/devices)
859 [ -z "$MDS" ] && error "No MDT" && return 8
863 cleanup_nocli || return 6
865 run_test 24a "Multiple MDTs on a single node"
868 local fs2mds_HOST=$mds_HOST
869 add fs2mds $MDS_MKFS_OPTS --fsname=${FSNAME}2 --mgs --reformat ${MDSDEV}_2 || exit 10
871 start fs2mds ${MDSDEV}_2 $MDS_MOUNT_OPTS && return 2
874 run_test 24b "Multiple MGSs on a single node (should return err)"
878 check_mount || return 2
879 local MODULES=$($LCTL modules | awk '{ print $2 }')
880 rmmod $MODULES 2>/dev/null || true
883 run_test 25 "Verify modules are referenced"
887 # we need modules before mount for sysctl, so make sure...
888 [ -z "$(lsmod | grep lustre)" ] && modprobe lustre
889 #define OBD_FAIL_MDS_FS_SETUP 0x135
890 do_facet mds "sysctl -w lustre.fail_loc=0x80000135"
891 start_mds && echo MDS started && return 1
893 DEVS=$(cat $LPROC/devices | wc -l)
894 [ $DEVS -gt 0 ] && return 2
895 unload_modules || return 203
897 run_test 26 "MDT startup failure cleans LOV (should return errs)"
903 if [ $# -gt 2 ]; then
909 echo "Setting $PARAM from $ORIG to $FINAL"
910 $LCTL conf_param $PARAM=$FINAL
917 if [ $RESULT -eq $FINAL ]; then
918 echo "Updated config after $WAIT sec (got $RESULT)"
922 if [ $WAIT -eq $MAX ]; then
923 echo "Config update not seen: wanted $FINAL got $RESULT"
926 echo "Waiting $(($MAX - $WAIT)) secs for config update"
931 start_ost || return 1
932 start_mds || return 2
933 echo "Requeue thread should have started: "
934 ps -e | grep ll_cfg_requeue
935 set_and_check "cat $LPROC/obdfilter/$FSNAME-OST0000/client_cache_seconds" "$FSNAME-OST0000.ost.client_cache_seconds" || return 3
938 run_test 27a "Reacquire MGS lock if OST started first"
943 set_and_check "cat $LPROC/mdt/$FSNAME-MDT0000/identity_acquire_expire" "$FSNAME-MDT0000.mdt.identity_acquire_expire" || return 3
944 set_and_check "cat $LPROC/mdc/$FSNAME-MDT0000-mdc-*/max_rpcs_in_flight" "$FSNAME-MDT0000.mdc.max_rpcs_in_flight" || return 4
947 run_test 27b "Reacquire MGS lock after failover"
951 TEST="cat $LPROC/llite/$FSNAME-*/max_read_ahead_whole_mb"
954 FINAL=$(($ORIG + 10))
955 set_and_check "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" || return 3
956 set_and_check "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" || return 3
957 umount_client $MOUNT || return 200
960 if [ $RESULT -ne $FINAL ]; then
961 echo "New config not seen: wanted $FINAL got $RESULT"
964 echo "New config success: got $RESULT"
968 run_test 28 "permanent parameter setting"
971 [ "$OSTCOUNT" -lt "2" ] && echo "skipping deactivate test" && return
972 setup > /dev/null 2>&1
976 local PARAM="$FSNAME-OST0001.osc.active"
977 local PROC_ACT="$LPROC/osc/$FSNAME-OST0001-osc-[^M]*/active"
978 local PROC_UUID="$LPROC/osc/$FSNAME-OST0001-osc-[^M]*/ost_server_uuid"
979 if [ ! -r $PROC_ACT ]; then
980 echo "Can't read $PROC_ACT"
981 ls $LPROC/osc/$FSNAME-*
984 ACTV=$(cat $PROC_ACT)
986 set_and_check "cat $PROC_ACT" "$PARAM" $DEAC || return 2
987 # also check ost_server_uuid status
988 RESULT=$(grep DEACTIV $PROC_UUID)
989 if [ -z "$RESULT" ]; then
990 echo "Live client not deactivated: $(cat $PROC_UUID)"
993 echo "Live client success: got $RESULT"
997 local MPROC="$LPROC/osc/$FSNAME-OST0001-osc-[M]*/active"
998 if [ -r $MPROC ]; then
1000 if [ $RESULT -ne $DEAC ]; then
1001 echo "MDT not deactivated: $(cat $MPROC)"
1004 echo "MDT deactivated also"
1007 # test new client starts deactivated
1008 umount_client $MOUNT || return 200
1010 RESULT=$(grep DEACTIV $PROC_UUID | grep NEW)
1011 if [ -z "$RESULT" ]; then
1012 echo "New client not deactivated from start: $(cat $PROC_UUID)"
1015 echo "New client success: got $RESULT"
1018 # make sure it reactivates
1019 set_and_check "cat $PROC_ACT" "$PARAM" $ACTV || return 6
1021 umount_client $MOUNT
1024 #writeconf to remove all ost2 traces for subsequent tests
1027 run_test 29 "permanently remove an OST"
1030 # start mds first after writeconf
1034 TEST="cat $LPROC/llite/$FSNAME-*/max_read_ahead_whole_mb"
1036 for i in $(seq 1 20); do
1037 set_and_check "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $i || return 3
1039 # make sure client restart still works
1040 umount_client $MOUNT
1041 mount_client $MOUNT || return 4
1042 [ "$($TEST)" -ne "$i" ] && return 5
1043 set_and_check "$TEST" "$FSNAME.llite.max_read_ahead_whole_mb" $ORIG || return 6
1046 run_test 30 "Big config llog"
1048 test_31() { # bug 10734
1049 # ipaddr must not exist
1050 mount -t lustre 4.3.2.1@tcp:/lustre $MOUNT || true
1053 run_test 31 "Connect to non-existent node (shouldn't crash)"
1056 [ -z "$TUNEFS" ] && echo "No tunefs" && return
1057 [ ! -r disk1_4.zip ] && echo "Cant find disk1_4.zip, skipping" && return
1058 unzip -o -j -d $TMP/$tdir disk1_4.zip || { echo "Cant unzip disk1_4, skipping" && return ; }
1060 sysctl lnet.debug=$PTLDEBUG
1062 $TUNEFS $TMP/$tdir/mds || error "tunefs failed"
1063 # nids are wrong, so client wont work, but server should start
1064 start mds $TMP/$tdir/mds "-o loop,exclude=lustre-OST0000" || return 3
1065 local UUID=$(cat $LPROC/mds/lustre-MDT0000/uuid)
1067 [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
1069 $TUNEFS --mgsnode=`hostname` $TMP/$tdir/ost1 || error "tunefs failed"
1070 start ost1 $TMP/$tdir/ost1 "-o loop" || return 5
1071 UUID=$(cat $LPROC/obdfilter/lustre-OST0000/uuid)
1073 [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
1075 local NID=$($LCTL list_nids | head -1)
1077 echo "OSC changes should return err:"
1078 $LCTL conf_param lustre-OST0000.osc.max_dirty_mb=15 && return 7
1079 $LCTL conf_param lustre-OST0000.failover.node=$NID && return 8
1081 echo "MDC changes should succeed:"
1082 $LCTL conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1083 $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
1086 # With a new good MDT failover nid, we should be able to mount a client
1087 # (but it cant talk to OST)
1088 local OLDMOUNTOPT=$MOUNTOPT
1089 MOUNTOPT="exclude=lustre-OST0000"
1091 MOUNTOPT=$OLDMOUNTOPT
1092 set_and_check "cat $LPROC/mdc/*/max_rpcs_in_flight" "lustre-MDT0000.mdc.max_rpcs_in_flight" || return 11
1094 zconf_umount `hostname` $MOUNT -f
1097 # mount a second time to make sure we didnt leave upgrade flag on
1098 $TUNEFS --dryrun $TMP/$tdir/mds || error "tunefs failed"
1099 start mds $TMP/$tdir/mds "-o loop,exclude=lustre-OST0000" || return 12
1102 [ -d $TMP/$tdir ] && rm -rf $TMP/$tdir
1104 run_test 32a "Upgrade from 1.4 (not live)"
1107 [ -z "$TUNEFS" ] && echo "No tunefs" && return
1108 [ ! -r disk1_4.zip ] && echo "Cant find disk1_4.zip, skipping" && return
1109 unzip -o -j -d $TMP/$tdir disk1_4.zip || { echo "Cant unzip disk1_4, skipping" && return ; }
1111 sysctl lnet.debug=$PTLDEBUG
1113 # writeconf will cause servers to register with their current nids
1114 $TUNEFS --writeconf $TMP/$tdir/mds || error "tunefs failed"
1115 start mds $TMP/$tdir/mds "-o loop" || return 3
1116 local UUID=$(cat $LPROC/mds/lustre-MDT0000/uuid)
1118 [ "$UUID" == "mdsA_UUID" ] || error "UUID is wrong: $UUID"
1120 $TUNEFS --mgsnode=`hostname` $TMP/$tdir/ost1 || error "tunefs failed"
1121 start ost1 $TMP/$tdir/ost1 "-o loop" || return 5
1122 UUID=$(cat $LPROC/obdfilter/lustre-OST0000/uuid)
1124 [ "$UUID" == "ost1_UUID" ] || error "UUID is wrong: $UUID"
1126 echo "OSC changes should succeed:"
1127 $LCTL conf_param lustre-OST0000.osc.max_dirty_mb=15 || return 7
1128 $LCTL conf_param lustre-OST0000.failover.node=$NID || return 8
1130 echo "MDC changes should succeed:"
1131 $LCTL conf_param lustre-MDT0000.mdc.max_rpcs_in_flight=9 || return 9
1134 # MDT and OST should have registered with new nids, so we should have
1135 # a fully-functioning client
1136 echo "Check client and old fs contents"
1138 set_and_check "cat $LPROC/mdc/*/max_rpcs_in_flight" "lustre-MDT0000.mdc.max_rpcs_in_flight" || return 11
1139 [ "$(cksum $MOUNT/passwd | cut -d' ' -f 1,2)" == "2479747619 779" ] || return 12
1143 [ -d $TMP/$tdir ] && rm -rf $TMP/$tdir
1145 run_test 32b "Upgrade from 1.4 with writeconf"
1147 umount_client $MOUNT
1152 echo "$0: completed"