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.
13 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
15 LUSTRE=${LUSTRE:-`dirname $0`/..}
16 RLUSTRE=${RLUSTRE:-$LUSTRE}
17 MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre}
19 . $LUSTRE/tests/test-framework.sh
23 . ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
28 add_mds mds1 --dev $MDSDEV --size $MDSSIZE
29 add_lov lov1 mds1 --stripe_sz $STRIPE_BYTES\
30 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
31 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
32 add_client client mds1 --lov lov1 --path $MOUNT
38 add_mds mds2 --dev $MDSDEV --size $MDSSIZE
39 add_lov lov2 mds2 --stripe_sz $STRIPE_BYTES\
40 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
41 add_ost ost2 --lov lov2 --dev $OSTDEV --size $OSTSIZE
42 add_client client --mds mds2 --lov lov2 --path $MOUNT2
46 echo "start mds1 service on `facet_active_host mds1`"
47 start mds1 --reformat $MDSLCONFARGS || return 94
48 start_lsvcgssd || return 501
51 echo "stop mds1 service on `facet_active_host mds1`"
52 stop mds1 $@ || return 97
57 echo "start ost service on `facet_active_host ost`"
58 start ost --reformat $OSTLCONFARGS || return 95
62 echo "stop ost service on `facet_active_host ost`"
63 stop ost $@ || return 98
68 start_lgssd || return 502
69 echo "mount lustre on ${MOUNTPATH}....."
70 zconf_mount `hostname` $MOUNTPATH || return 96
75 echo "umount lustre on ${MOUNTPATH}....."
76 zconf_umount `hostname` $MOUNTPATH || return 97
80 manual_umount_client(){
81 echo "manual umount lustre on ${MOUNTPATH}...."
82 do_facet client "umount $MOUNT"
93 umount_client $MOUNT || return 200
94 stop_mds || return 201
95 stop_ost || return 202
96 # catch case where these return just fine, but modules are still not unloaded
97 /sbin/lsmod | grep -q portals
99 echo "modules still loaded..."
105 do_facet client "touch $DIR/a" || return 71
106 do_facet client "rm $DIR/a" || return 72
107 echo "setup single mount lustre success"
111 do_facet client "touch $DIR/a" || return 71
112 do_facet client "rm $DIR/a" || return 72
113 do_facet client "touch $DIR2/a" || return 73
114 do_facet client "rm $DIR2/a" || return 74
115 echo "setup double mount lustre success"
120 #create single point mountpoint
123 start_krb5_kdc || exit 1
130 check_mount || return 41
133 run_test 0 "single mount setup"
137 echo "start ost second time..."
138 start ost --reformat $OSTLCONFARGS
141 check_mount || return 42
144 run_test 1 "start up ost twice"
149 echo "start mds second time.."
150 start mds1 --reformat $MDSLCONFARGS
153 check_mount || return 43
156 run_test 2 "start up mds twice"
162 check_mount || return 44
167 run_test 3 "mount client twice"
171 touch $DIR/$tfile || return 85
175 # ok for ost to fail shutdown
176 if [ 202 -ne $eno ]; then
181 run_test 4 "force cleanup ost, then cleanup"
185 touch $DIR/$tfile || return 1
186 stop_mds --force || return 2
188 # cleanup may return an error from the failed
189 # disconnects; for now I'll consider this successful
190 # if all the modules have unloaded.
194 echo "killing umount"
195 kill -TERM $UMOUNT_PID
196 echo "waiting for umount to finish"
200 # cleanup client modules
201 $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
203 # stop_mds is a no-op here, and should not fail
207 lsmod | grep -q portals && return 6
210 run_test 5 "force cleanup mds, then cleanup"
217 [ -d $MOUNT ] || mkdir -p $MOUNT
218 $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
219 start_lgssd || return 1
220 llmount $mds_HOST://mds1_svc/client_facet $MOUNT && exit 1
222 # cleanup client modules
223 $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
226 # stop_mds is a no-op here, and should not fail
230 lsmod | grep -q portals && return 4
234 run_test 5b "mds down, cleanup after failed mount (bug 2712)"
240 [ -d $MOUNT ] || mkdir -p $MOUNT
241 $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
242 start_lgssd || return 1
243 llmount $mds_HOST://wrong_mds1_svc/client_facet $MOUNT && return 2
245 # cleanup client modules
246 $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
252 lsmod | grep -q portals && return 5
256 run_test 5c "cleanup after failed mount (bug 2712)"
263 [ -d $MOUNT ] || mkdir -p $MOUNT
264 $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
265 start_lgssd || return 1
266 llmount $mds_HOST://mds1_svc/client_facet $MOUNT || return 1
268 umount $MOUNT || return 2
269 # cleanup client modules
270 $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
275 lsmod | grep -q portals && return 4
279 run_test 5d "ost down, don't crash during mount attempt"
284 mount_client ${MOUNT} || return 87
285 touch $DIR/a || return 86
288 run_test 6 "manual umount, then mount again"
295 run_test 7 "manual umount, then cleanup"
304 check_mount2 || return 45
306 umount_client $MOUNT2
311 run_test 8 "double mount setup"
314 # backup the old values of PTLDEBUG and SUBSYSTEM
315 OLDPTLDEBUG=$PTLDEBUG
316 OLDSUBSYSTEM=$SUBSYSTEM
318 # generate new configuration file with lmc --ptldebug and --subsystem
323 # check the result of lmc --ptldebug/subsystem
327 CHECK_PTLDEBUG="`cat /proc/sys/portals/debug`"
328 if [ $CHECK_PTLDEBUG = "1" ]; then
329 echo "lmc --debug success"
331 echo "lmc --debug: want 1, have $CHECK_PTLDEBUG"
334 CHECK_SUBSYSTEM="`cat /proc/sys/portals/subsystem_debug`"
335 if [ $CHECK_SUBSYSTEM = "2" ]; then
336 echo "lmc --subsystem success"
338 echo "lmc --subsystem: want 2, have $CHECK_SUBSYSTEM"
341 check_mount || return 41
344 # the new PTLDEBUG/SUBSYSTEM used for lconf --ptldebug/subsystem
345 PTLDEBUG="inode+trace"
348 # check lconf --ptldebug/subsystem overriding lmc --ptldebug/subsystem
351 CHECK_PTLDEBUG="`do_facet mds1 cat /proc/sys/portals/debug`"
352 if [ $CHECK_PTLDEBUG = "3" ]; then
353 echo "lconf --debug success"
355 echo "lconf --debug: want 3, have $CHECK_PTLDEBUG"
358 CHECK_SUBSYSTEM="`do_facet mds1 cat /proc/sys/portals/subsystem_debug`"
359 if [ $CHECK_SUBSYSTEM = "20" ]; then
360 echo "lconf --subsystem success"
362 echo "lconf --subsystem: want 20, have $CHECK_SUBSYSTEM"
366 check_mount || return 41
369 # resume the old configuration
370 PTLDEBUG=$OLDPTLDEBUG
371 SUBSYSTEM=$OLDSUBSYSTEM
375 run_test 9 "test --ptldebug and --subsystem for lmc and lconf"
378 echo "generate configuration with the same name for node and mds"
379 OLDXMLCONFIG=$XMLCONFIG
380 XMLCONFIG="broken.xml"
381 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
385 echo "the name for node and mds is the same"
386 do_lmc --add mds --node ${facet}_facet --mds ${facet}_facet \
387 --dev $MDSDEV --size $MDSSIZE || return $?
388 do_lmc --add lov --mds ${facet}_facet --lov lov1 --stripe_sz \
389 $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ \
390 --stripe_pattern 0 || return $?
391 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
393 add_facet $facet --lustre_upcall $UPCALL
394 do_lmc --add mtpt --node ${facet}_facet --mds mds1_facet \
395 --lov lov1 --path $MOUNT
401 check_mount || return 41
405 XMLCONFIG=$OLDXMLCONFIG
407 run_test 10 "mount lustre with the same name for node and mds"
410 OLDXMLCONFIG=$XMLCONFIG
411 XMLCONFIG="conf11.xml"
413 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
414 add_mds mds1 --dev $MDSDEV --size $MDSSIZE
415 add_ost ost --dev $OSTDEV --size $OSTSIZE
416 add_client client mds1 --path $MOUNT --ost ost_svc || return $?
417 echo "Default lov config success!"
419 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
420 add_mds mds1 --dev $MDSDEV --size $MDSSIZE
421 add_ost ost --dev $OSTDEV --size $OSTSIZE
422 add_client client mds1 --path $MOUNT && return $?
423 echo "--add mtpt with neither --lov nor --ost will return error"
427 XMLCONFIG=$OLDXMLCONFIG
429 run_test 11 "use default lov configuration (should return error)"
432 OLDXMLCONFIG=$XMLCONFIG
433 XMLCONFIG="batch.xml"
434 BATCHFILE="batchfile"
437 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
438 [ -f "$BATCHFILE" ] && rm -f $BATCHFILE
439 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
440 echo "--add mds --node localhost --mds mds1 --mkfsoptions \"-I 128\"" >> $BATCHFILE
441 # --mkfsoptions "-I 128"
442 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
443 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
444 echo "matched double quote success"
446 echo "matched double quote fail"
451 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
452 echo "--add mds --node localhost --mds mds1 --mkfsoptions \"-I 128" >> $BATCHFILE
453 # --mkfsoptions "-I 128
454 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
455 echo "unmatched double quote should return error"
459 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
460 echo "--add mds --node localhost --mds mds1 --mkfsoptions '-I 128'" >> $BATCHFILE
461 # --mkfsoptions '-I 128'
462 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
463 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
464 echo "matched single quote success"
466 echo "matched single quote fail"
471 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
472 echo "--add mds --node localhost --mds mds1 --mkfsoptions '-I 128" >> $BATCHFILE
473 # --mkfsoptions '-I 128
474 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
475 echo "unmatched single quote should return error"
479 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
480 echo "--add mds --node localhost --mds mds1 --mkfsoptions \-\I\ \128" >> $BATCHFILE
481 # --mkfsoptions \-\I\ \128
482 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
483 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
484 echo "backslash followed by a whitespace/letter success"
486 echo "backslash followed by a whitespace/letter fail"
491 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
492 echo "--add mds --node localhost --mds mds1 --mkfsoptions -I\ 128\\" >> $BATCHFILE
493 # --mkfsoptions -I\ 128\
494 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
495 echo "backslash followed by nothing should return error"
498 XMLCONFIG=$OLDXMLCONFIG
500 run_test 12 "lmc --batch, with single/double quote, backslash in batchfile"
503 OLDXMLCONFIG=$XMLCONFIG
504 XMLCONFIG="conf13-1.xml"
505 SECONDXMLCONFIG="conf13-2.xml"
507 # check long uuid will be truncated properly and uniquely
508 echo "To generate XML configuration file(with long ost name): $XMLCONFIG"
509 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
510 do_lmc --add net --node localhost --nid localhost.localdomain --nettype tcp
511 do_lmc --add mds --node localhost --mds mds1_name_longer_than_31characters
512 do_lmc --add mds --node localhost --mds mds2_name_longer_than_31characters
513 if [ ! -f "$XMLCONFIG" ]; then
514 echo "Error:no file $XMLCONFIG created!"
517 EXPECTEDMDS1UUID="e_longer_than_31characters_UUID"
518 EXPECTEDMDS2UUID="longer_than_31characters_UUID_2"
519 FOUNDMDS1UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '1p' \
520 | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
521 FOUNDMDS2UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '2p' \
522 | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
523 if ([ $EXPECTEDMDS1UUID = $FOUNDMDS1UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS2UUID ]) || \
524 ([ $EXPECTEDMDS1UUID = $FOUNDMDS2UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS1UUID ]); then
525 echo "Success:long uuid truncated successfully and being unique."
527 echo "Error:expected uuid for mds1 and mds2: $EXPECTEDMDS1UUID; $EXPECTEDMDS2UUID"
528 echo "but: found uuid for mds1 and mds2: $FOUNDMDS1UUID; $FOUNDMDS2UUID"
532 # check multiple invocations for lmc generate same XML configuration file
534 echo "Generate the first XML configuration file"
536 echo "mv $XMLCONFIG to $SECONDXMLCONFIG"
537 mv $XMLCONFIG $SECONDXMLCONFIG || return $?
538 echo "Generate the second XML configuration file"
540 if [ `diff $XMLCONFIG $SECONDXMLCONFIG | wc -l` -eq 0 ]; then
541 echo "Success:multiple invocations for lmc generate same XML file"
543 echo "Error: multiple invocations for lmc generate different XML file"
548 rm -f $SECONDXMLCONFIG
549 XMLCONFIG=$OLDXMLCONFIG
551 run_test 13 "check new_uuid of lmc operating correctly"
556 # create xml file with --mkfsoptions for ost
557 echo "create xml file with --mkfsoptions for ost"
558 add_mds mds1 --dev $MDSDEV --size $MDSSIZE
559 add_lov lov1 mds1 --stripe_sz $STRIPE_BYTES\
560 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
561 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE \
562 --mkfsoptions "-Llabel_conf_14"
563 add_client client mds1 --lov lov1 --path $MOUNT
565 FOUNDSTRING=`awk -F"<" '/<mkfsoptions>/{print $2}' $XMLCONFIG`
566 EXPECTEDSTRING="mkfsoptions>-Llabel_conf_14"
567 if [ $EXPECTEDSTRING != $FOUNDSTRING ]; then
568 echo "Error: expected: $EXPECTEDSTRING; found: $FOUNDSTRING"
571 echo "Success:mkfsoptions for ost written to xml file correctly."
573 # mount lustre to test lconf mkfsoptions-parsing
577 mount_client $MOUNT || return $?
578 if [ -z "`dumpe2fs -h $OSTDEV | grep label_conf_14`" ]; then
579 echo "Error: the mkoptions not applied to mke2fs of ost."
583 echo "lconf mkfsoptions for ost success"
587 run_test 14 "test mkfsoptions of ost for lmc and lconf"
591 [ -f $MOUNTLUSTRE ] && echo "remove $MOUNTLUSTRE" && rm -f $MOUNTLUSTRE
592 if [ -f $MOUNTLUSTRE.sav ]; then
593 echo "return original $MOUNTLUSTRE.sav to $MOUNTLUSTRE"
594 mv $MOUNTLUSTRE.sav $MOUNTLUSTRE
601 echo "mount lustre on ${MOUNT} with $MOUNTLUSTRE....."
602 if [ -f "$MOUNTLUSTRE" ]; then
603 echo "save $MOUNTLUSTRE to $MOUNTLUSTRE.sav"
604 mv $MOUNTLUSTRE $MOUNTLUSTRE.sav
606 [ -f "$MOUNTLUSTRE" ] && echo "can't move $MOUNTLUSTRE" && return 40
607 trap cleanup_15 EXIT INT
608 [ ! `cp $LUSTRE/utils/llmount $MOUNTLUSTRE` ] || return $?
609 do_node `hostname` mkdir -p $MOUNT 2> /dev/null
610 # load llite module on the client if it isn't in /lib/modules
611 do_node `hostname` lconf --nosetup --node client_facet $XMLCONFIG
612 do_node `hostname` mount -t lustre -o nettype=$NETTYPE \
613 `facet_active_host mds1`:/mds1_svc/client_facet $MOUNT ||return $?
614 echo "mount lustre on $MOUNT with $MOUNTLUSTRE: success"
615 [ -d /r ] && $LCTL modules > /r/tmp/ogdb-`hostname`
616 check_mount || return 41
617 do_node `hostname` umount $MOUNT
619 [ -f "$MOUNTLUSTRE" ] && rm -f $MOUNTLUSTRE
620 echo "mount lustre on ${MOUNT} without $MOUNTLUSTRE....."
621 do_node `hostname` mount -t lustre -o nettype=$NETTYPE \
622 `facet_active_host mds1`:/mds1_svc/client_facet $MOUNT &&return $?
623 echo "mount lustre on $MOUNT without $MOUNTLUSTRE failed as expected"
627 run_test 15 "zconf-mount without /sbin/mount.lustre (should return error)"
631 echo $value | grep -q "^[[:digit:]]*$"
636 TMPMTPT="/mnt/conf16"
638 if [ ! -f "$MDSDEV" ]; then
639 echo "no $MDSDEV existing, so mount Lustre to create one"
643 check_mount || return 41
647 echo "change the mode of $MDSDEV/OBJECTS,LOGS,PENDING to 555"
648 [ -d $TMPMTPT ] || mkdir -p $TMPMTPT
649 mount -o loop -t ext3 $MDSDEV $TMPMTPT || return $?
650 chmod 555 $TMPMTPT/OBJECTS || return $?
651 chmod 555 $TMPMTPT/LOGS || return $?
652 chmod 555 $TMPMTPT/PENDING || return $?
653 umount $TMPMTPT || return $?
655 echo "mount Lustre to change the mode of OBJECTS/LOGS/PENDING, then umount Lustre"
659 check_mount || return 41
662 echo "read the mode of OBJECTS/LOGS/PENDING and check if they has been changed properly"
663 EXPECTEDOBJECTSMODE=`debugfs -R "stat OBJECTS" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'`
664 EXPECTEDLOGSMODE=`debugfs -R "stat LOGS" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'`
665 EXPECTEDPENDINGMODE=`debugfs -R "stat PENDING" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'`
667 # check if values are empty
668 test "x$EXPECTEDOBJECTSMODE" = "x" && EXPECTEDOBJECTSMODE="<empty>"
669 test "x$EXPECTEDLOGSMODE" = "x" && EXPECTEDLOGSMODE="<empty>"
670 test "x$EXPECTEDPENDINGMODE" = "x" && EXPECTEDPENDINGMODE="<empty>"
672 # check if values are valid digits
673 is_digit $EXPECTEDOBJECTSMODE || {
674 echo "Invalid OBJECTS mode obtained from debugfs: $EXPECTEDOBJECTSMODE"
678 is_digit $EXPECTEDLOGSMODE || {
679 echo "Invalid LOGS mode obtained from debugfs: $EXPECTEDLOGSMODE"
683 is_digit $EXPECTEDPENDINGMODE || {
684 echo "Invalid PINDING mode obtained from debugfs: $EXPECTEDPENDINGMODE"
688 # check if values are those we expected
689 if [ "x$EXPECTEDOBJECTSMODE" = "x0777" ]; then
690 echo "Success: Lustre change the mode of OBJECTS correctly"
692 echo "Error: Lustre does not change the mode of OBJECTS properly"
693 echo "Expected value: 0777, actual one: $EXPECTEDOBJECTSMODE"
697 if [ "x$EXPECTEDLOGSMODE" = "x0777" ]; then
698 echo "Success: Lustre change the mode of LOGS correctly"
700 echo "Error: Lustre does not change the mode of LOGS properly"
701 echo "Expected value: 0777, actual one: $EXPECTEDLOGSMODE"
705 if [ "x$EXPECTEDPENDINGMODE" = "x0777" ]; then
706 echo "Success: Lustre change the mode of PENDING correctly"
708 echo "Error: Lustre does not change the mode of PENDING properly"
709 echo "Expected value: 0777, actual one: $EXPECTEDPENDINGMODE"
713 run_test 16 "verify that lustre will correct the mode of OBJECTS/LOGS/PENDING"
716 TMPMTPT="/mnt/conf17"
718 if [ ! -f "$MDSDEV" ]; then
719 echo "no $MDSDEV existing, so mount Lustre to create one"
723 check_mount || return 41
727 echo "Remove mds config log"
728 [ -d $TMPMTPT ] || mkdir -p $TMPMTPT
729 mount -o loop -t ext3 $MDSDEV $TMPMTPT || return $?
730 rm -f $TMPMTPT/LOGS/mds1_svc || return $?
731 umount $TMPMTPT || return $?
734 start mds1 $MDSLCONFARGS && return 42
737 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936)"
740 [ -f $MDSDEV ] && echo "remove $MDSDEV" && rm -f $MDSDEV
741 echo "mount mds with large journal..."
746 echo "mount lustre system..."
750 check_mount || return 41
752 echo "check journal size..."
753 FOUNDJOURNALSIZE=`debugfs -R "stat <8>" $MDSDEV | awk '/Size: / { print $6; exit;}'`
754 if [ $FOUNDJOURNALSIZE = "79691776" ]; then
755 echo "Success:lconf creates large journals"
757 echo "Error:lconf not create large journals correctly"
758 echo "expected journal size: 79691776(76M), found journal size: $FOUNDJOURNALSIZE"
767 run_test 18 "check lconf creates large journals"