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}
18 . $LUSTRE/tests/test-framework.sh
22 . ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
27 add_mds mds --dev $MDSDEV --size $MDSSIZE
28 add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
29 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
30 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
31 add_client client mds --lov lov1 --path $MOUNT
37 add_mds mds2 --dev $MDSDEV --size $MDSSIZE
38 add_lov lov2 mds2 --stripe_sz $STRIPE_BYTES\
39 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
40 add_ost ost2 --lov lov2 --dev $OSTDEV --size $OSTSIZE
41 add_client client mds2 --lov lov2 --path $MOUNT2
45 echo "start mds service on `facet_active_host mds`"
46 start mds --reformat $MDSLCONFARGS || return 94
49 echo "stop mds service on `facet_active_host mds`"
50 stop mds $@ || return 97
54 echo "start ost service on `facet_active_host ost`"
55 start ost --reformat $OSTLCONFARGS || return 95
59 echo "stop ost service on `facet_active_host ost`"
60 stop ost $@ || return 98
65 echo "mount lustre on ${MOUNTPATH}....."
66 zconf_mount `hostname` $MOUNTPATH || return 96
71 echo "umount lustre on ${MOUNTPATH}....."
72 zconf_umount `hostname` $MOUNTPATH || return 97
75 manual_umount_client(){
76 echo "manual umount lustre on ${MOUNTPATH}...."
77 do_facet client "umount $MOUNT"
87 umount_client $MOUNT || return 200
88 stop_mds || return 201
89 stop_ost || return 202
90 # catch case where these return just fine, but modules are still not unloaded
91 /sbin/lsmod | grep -q portals
93 echo "modules still loaded..."
99 do_facet client "touch $DIR/a" || return 71
100 do_facet client "rm $DIR/a" || return 72
101 echo "setup single mount lustre success"
105 do_facet client "touch $DIR/a" || return 71
106 do_facet client "rm $DIR/a" || return 72
107 do_facet client "touch $DIR2/a" || return 73
108 do_facet client "rm $DIR2/a" || return 74
109 echo "setup double mount lustre success"
114 #create single point mountpoint
123 check_mount || return 41
126 run_test 0 "single mount setup"
130 echo "start ost second time..."
131 start ost --reformat $OSTLCONFARGS
134 check_mount || return 42
137 run_test 1 "start up ost twice"
142 echo "start mds second time.."
143 start mds --reformat $MDSLCONFARGS
146 check_mount || return 43
149 run_test 2 "start up mds twice"
155 check_mount || return 44
160 run_test 3 "mount client twice"
164 touch $DIR/$tfile || return 85
168 # ok for ost to fail shutdown
169 if [ 202 -ne $eno ]; then
174 run_test 4 "force cleanup ost, then cleanup"
178 touch $DIR/$tfile || return 1
179 stop_mds --force || return 2
181 # cleanup may return an error from the failed
182 # disconnects; for now I'll consider this successful
183 # if all the modules have unloaded.
187 echo "killing umount"
188 kill -TERM $UMOUNT_PID
189 echo "waiting for umount to finish"
192 # cleanup client modules
193 $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
195 # stop_mds is a no-op here, and should not fail
199 lsmod | grep -q portals && return 6
202 run_test 5 "force cleanup mds, then cleanup"
209 [ -d $MOUNT ] || mkdir -p $MOUNT
210 $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
211 llmount $mds_HOST://mds_svc/client_facet $MOUNT && exit 1
213 # cleanup client modules
214 $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
216 # stop_mds is a no-op here, and should not fail
220 lsmod | grep -q portals && return 3
224 run_test 5b "mds down, cleanup after failed mount (bug 2712)"
230 [ -d $MOUNT ] || mkdir -p $MOUNT
231 $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
232 llmount $mds_HOST://wrong_mds_svc/client_facet $MOUNT && exit 1
234 # cleanup client modules
235 $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
240 lsmod | grep -q portals && return 3
244 run_test 5c "cleanup after failed mount (bug 2712)"
249 mount_client ${MOUNT} || return 87
250 touch $DIR/a || return 86
253 run_test 6 "manual umount, then mount again"
260 run_test 7 "manual umount, then cleanup"
269 check_mount2 || return 45
271 umount_client $MOUNT2
276 run_test 8 "double mount setup"
279 # backup the old values of PTLDEBUG and SUBSYSTEM
280 OLDPTLDEBUG=$PTLDEBUG
281 OLDSUBSYSTEM=$SUBSYSTEM
283 # generate new configuration file with lmc --ptldebug and --subsystem
288 # check the result of lmc --ptldebug/subsystem
292 CHECK_PTLDEBUG="`cat /proc/sys/portals/debug`"
293 if [ $CHECK_PTLDEBUG = "1" ]; then
294 echo "lmc --debug success"
296 echo "lmc --debug: want 1, have $CHECK_PTLDEBUG"
299 CHECK_SUBSYSTEM="`cat /proc/sys/portals/subsystem_debug`"
300 if [ $CHECK_SUBSYSTEM = "2" ]; then
301 echo "lmc --subsystem success"
303 echo "lmc --subsystem: want 2, have $CHECK_SUBSYSTEM"
306 check_mount || return 41
309 # the new PTLDEBUG/SUBSYSTEM used for lconf --ptldebug/subsystem
310 PTLDEBUG="inode+trace"
313 # check lconf --ptldebug/subsystem overriding lmc --ptldebug/subsystem
316 CHECK_PTLDEBUG="`do_facet mds cat /proc/sys/portals/debug`"
317 if [ $CHECK_PTLDEBUG = "3" ]; then
318 echo "lconf --debug success"
320 echo "lconf --debug: want 3, have $CHECK_PTLDEBUG"
323 CHECK_SUBSYSTEM="`do_facet mds cat /proc/sys/portals/subsystem_debug`"
324 if [ $CHECK_SUBSYSTEM = "20" ]; then
325 echo "lconf --subsystem success"
327 echo "lconf --subsystem: want 20, have $CHECK_SUBSYSTEM"
331 check_mount || return 41
334 # resume the old configuration
335 PTLDEBUG=$OLDPTLDEBUG
336 SUBSYSTEM=$OLDSUBSYSTEM
340 run_test 9 "test --ptldebug and --subsystem for lmc and lconf"
343 OLDXMLCONFIG=$XMLCONFIG
344 XMLCONFIG="broken.xml"
345 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
347 do_lmc --add node --node $SAMENAME
348 do_lmc --add net --node $SAMENAME --nid $SAMENAME --nettype tcp
349 do_lmc --add mds --node $SAMENAME --mds $SAMENAME --nid $SAMENAME \
350 --fstype ext3 --dev /dev/mds1 || return $?
351 do_lmc --add lov --lov lov1 --mds $SAMENAME --stripe_sz 65536 \
352 --stripe_cnt 1 --stripe_pattern 0 || return $?
354 XMLCONFIG=$OLDXMLCONFIG
356 run_test 10 "use lmc with the same name for node and mds"
359 OLDXMLCONFIG=$XMLCONFIG
360 XMLCONFIG="conf11.xml"
362 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
363 add_mds mds --dev $MDSDEV --size $MDSSIZE
364 add_ost ost --dev $OSTDEV --size $OSTSIZE
365 add_client client mds --path $MOUNT --ost ost_svc || return $?
366 echo "Default lov config success!"
368 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
369 add_mds mds --dev $MDSDEV --size $MDSSIZE
370 add_ost ost --dev $OSTDEV --size $OSTSIZE
371 add_client client mds --path $MOUNT && return $?
372 echo "--add mtpt with neither --lov nor --ost will return error"
376 XMLCONFIG=$OLDXMLCONFIG
378 run_test 11 "use default lov configuration (should return error)"
381 OLDXMLCONFIG=$XMLCONFIG
382 XMLCONFIG="batch.xml"
383 BATCHFILE="batchfile"
386 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
387 [ -f "$BATCHFILE" ] && rm -f $BATCHFILE
388 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
389 echo "--add mds --node localhost --mds mds1 --mkfsoptions \"-I 128\"" >> $BATCHFILE
390 # --mkfsoptions "-I 128"
391 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
392 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
393 echo "matched double quote success"
395 echo "matched double quote fail"
400 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
401 echo "--add mds --node localhost --mds mds1 --mkfsoptions \"-I 128" >> $BATCHFILE
402 # --mkfsoptions "-I 128
403 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
404 echo "unmatched double quote should return error"
408 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
409 echo "--add mds --node localhost --mds mds1 --mkfsoptions '-I 128'" >> $BATCHFILE
410 # --mkfsoptions '-I 128'
411 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
412 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
413 echo "matched single quote success"
415 echo "matched single quote fail"
420 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
421 echo "--add mds --node localhost --mds mds1 --mkfsoptions '-I 128" >> $BATCHFILE
422 # --mkfsoptions '-I 128
423 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
424 echo "unmatched single quote should return error"
428 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
429 echo "--add mds --node localhost --mds mds1 --mkfsoptions \-\I\ \128" >> $BATCHFILE
430 # --mkfsoptions \-\I\ \128
431 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
432 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
433 echo "backslash followed by a whitespace/letter success"
435 echo "backslash followed by a whitespace/letter fail"
440 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
441 echo "--add mds --node localhost --mds mds1 --mkfsoptions -I\ 128\\" >> $BATCHFILE
442 # --mkfsoptions -I\ 128\
443 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
444 echo "backslash followed by nothing should return error"
447 XMLCONFIG=$OLDXMLCONFIG
449 run_test 12 "lmc --batch, with single/double quote, backslash in batchfile"
452 OLDXMLCONFIG=$XMLCONFIG
453 XMLCONFIG="conf13-1.xml"
454 SECONDXMLCONFIG="conf13-2.xml"
456 # check long uuid will be truncated properly and uniquely
457 echo "To generate XML configuration file(with long ost name): $XMLCONFIG"
458 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
459 do_lmc --add net --node localhost --nid localhost.localdomain --nettype tcp
460 do_lmc --add mds --node localhost --mds mds1_name_longer_than_31characters
461 do_lmc --add mds --node localhost --mds mds2_name_longer_than_31characters
462 if [ ! -f "$XMLCONFIG" ]; then
463 echo "Error:no file $XMLCONFIG created!"
466 EXPECTEDMDS1UUID="e_longer_than_31characters_UUID"
467 EXPECTEDMDS2UUID="longer_than_31characters_UUID_2"
468 FOUNDMDS1UUID=`awk -F"'" '/<mds uuid=/{print $2}' $XMLCONFIG | sed -n '1p'`
469 FOUNDMDS2UUID=`awk -F"'" '/<mds uuid=/{print $2}' $XMLCONFIG | sed -n '2p'`
470 if [ $EXPECTEDMDS1UUID != $FOUNDMDS1UUID ]; then
471 echo "Error:expected uuid for mds1: $EXPECTEDMDS1UUID; found: $FOUNDMDS1UUID"
474 if [ $EXPECTEDMDS2UUID != $FOUNDMDS2UUID ]; then
475 echo "Error:expected uuid for mds2: $EXPECTEDMDS2UUID; found: $FOUNDMDS2UUID"
478 echo "Success:long uuid truncated successfully and being unique."
480 # check multiple invocations for lmc generate same XML configuration file
482 echo "Generate the first XML configuration file"
484 echo "mv $XMLCONFIG to $SECONDXMLCONFIG"
485 mv $XMLCONFIG $SECONDXMLCONFIG || return $?
486 echo "Generate the second XML configuration file"
488 if [ `diff $XMLCONFIG $SECONDXMLCONFIG | wc -l` -eq 0 ]; then
489 echo "Success:multiple invocations for lmc generate same XML file"
491 echo "Error: multiple invocations for lmc generate different XML file"
496 rm -f $SECONDXMLCONFIG
497 XMLCONFIG=$OLDXMLCONFIG
499 run_test 13 "check new_uuid of lmc operating correctly"
504 # create xml file with --mkfsoptions for ost
505 echo "create xml file with --mkfsoptions for ost"
506 add_mds mds --dev $MDSDEV --size $MDSSIZE
507 add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
508 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
509 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE \
510 --mkfsoptions "-Llabel_conf_15"
511 add_client client mds --lov lov1 --path $MOUNT
513 FOUNDSTRING=`awk -F"<" '/<mkfsoptions>/{print $2}' $XMLCONFIG`
514 EXPECTEDSTRING="mkfsoptions>-Llabel_conf_15"
515 if [ $EXPECTEDSTRING != $FOUNDSTRING ]; then
516 echo "Error: expected: $EXPECTEDSTRING; found: $FOUNDSTRING"
519 echo "Success:mkfsoptions for ost written to xml file correctly."
521 # mount lustre to test lconf mkfsoptions-parsing
525 mount_client $MOUNT || return $?
526 if [ -z "`dumpe2fs -h $OSTDEV | grep label_conf_15`" ]; then
527 echo "Error: the mkoptions not applied to mke2fs of ost."
531 echo "lconf mkfsoptions for ost success"
535 run_test 14 "test mkfsoptions of ost for lmc and lconf"