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
191 # cleanup client modules
192 $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
194 # stop_mds is a no-op here, and should not fail
198 lsmod | grep -q portals && return 6
201 run_test 5 "force cleanup mds, then cleanup"
206 mount_client ${MOUNT} || return 87
207 touch $DIR/a || return 86
210 run_test 6 "manual umount, then mount again"
217 run_test 7 "manual umount, then cleanup"
226 check_mount2 || return 45
228 umount_client $MOUNT2
233 run_test 8 "double mount setup"
236 # backup the old values of PTLDEBUG and SUBSYSTEM
237 OLDPTLDEBUG=$PTLDEBUG
238 OLDSUBSYSTEM=$SUBSYSTEM
240 # generate new configuration file with lmc --ptldebug and --subsystem
245 # check the result of lmc --ptldebug/subsystem
249 CHECK_PTLDEBUG="`cat /proc/sys/portals/debug`"
250 if [ $CHECK_PTLDEBUG = "1" ]; then
251 echo "lmc --debug success"
253 echo "lmc --debug: want 1, have $CHECK_PTLDEBUG"
256 CHECK_SUBSYSTEM="`cat /proc/sys/portals/subsystem_debug`"
257 if [ $CHECK_SUBSYSTEM = "2" ]; then
258 echo "lmc --subsystem success"
260 echo "lmc --subsystem: want 2, have $CHECK_SUBSYSTEM"
263 check_mount || return 41
266 # the new PTLDEBUG/SUBSYSTEM used for lconf --ptldebug/subsystem
267 PTLDEBUG="inode+trace"
270 # check lconf --ptldebug/subsystem overriding lmc --ptldebug/subsystem
273 CHECK_PTLDEBUG="`do_facet mds cat /proc/sys/portals/debug`"
274 if [ $CHECK_PTLDEBUG = "3" ]; then
275 echo "lconf --debug success"
277 echo "lconf --debug: want 3, have $CHECK_PTLDEBUG"
280 CHECK_SUBSYSTEM="`do_facet mds cat /proc/sys/portals/subsystem_debug`"
281 if [ $CHECK_SUBSYSTEM = "20" ]; then
282 echo "lconf --subsystem success"
284 echo "lconf --subsystem: want 20, have $CHECK_SUBSYSTEM"
288 check_mount || return 41
291 # resume the old configuration
292 PTLDEBUG=$OLDPTLDEBUG
293 SUBSYSTEM=$OLDSUBSYSTEM
297 run_test 9 "test --ptldebug and --subsystem for lmc and lconf"
300 OLDXMLCONFIG=$XMLCONFIG
301 XMLCONFIG="broken.xml"
302 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
304 do_lmc --add node --node $SAMENAME
305 do_lmc --add net --node $SAMENAME --nid $SAMENAME --nettype tcp
306 do_lmc --add mds --node $SAMENAME --mds $SAMENAME --nid $SAMENAME \
307 --fstype ext3 --dev /dev/mds1 || return $?
308 do_lmc --add lov --lov lov1 --mds $SAMENAME --stripe_sz 65536 \
309 --stripe_cnt 1 --stripe_pattern 0 || return $?
311 XMLCONFIG=$OLDXMLCONFIG
313 run_test 10 "use lmc with the same name for node and mds"
316 OLDXMLCONFIG=$XMLCONFIG
317 XMLCONFIG="conf11.xml"
319 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
320 add_mds mds --dev $MDSDEV --size $MDSSIZE
321 add_ost ost --dev $OSTDEV --size $OSTSIZE
322 add_client client mds --path $MOUNT --ost ost_svc || return $?
323 echo "Default lov config success!"
325 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
326 add_mds mds --dev $MDSDEV --size $MDSSIZE
327 add_ost ost --dev $OSTDEV --size $OSTSIZE
328 add_client client mds --path $MOUNT && return $?
329 echo "--add mtpt with neither --lov nor --ost will return error"
333 XMLCONFIG=$OLDXMLCONFIG
335 run_test 11 "use default lov configuration (should return error)"
338 OLDXMLCONFIG=$XMLCONFIG
339 XMLCONFIG="batch.xml"
340 BATCHFILE="batchfile"
343 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
344 [ -f "$BATCHFILE" ] && rm -f $BATCHFILE
345 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
346 echo "--add mds --node localhost --mds mds1 --mkfsoptions \"-I 128\"" >> $BATCHFILE
347 # --mkfsoptions "-I 128"
348 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
349 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
350 echo "matched double quote success"
352 echo "matched double quote fail"
357 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
358 echo "--add mds --node localhost --mds mds1 --mkfsoptions \"-I 128" >> $BATCHFILE
359 # --mkfsoptions "-I 128
360 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
361 echo "unmatched double quote should return error"
365 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
366 echo "--add mds --node localhost --mds mds1 --mkfsoptions '-I 128'" >> $BATCHFILE
367 # --mkfsoptions '-I 128'
368 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
369 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
370 echo "matched single quote success"
372 echo "matched single quote fail"
377 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
378 echo "--add mds --node localhost --mds mds1 --mkfsoptions '-I 128" >> $BATCHFILE
379 # --mkfsoptions '-I 128
380 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
381 echo "unmatched single quote should return error"
385 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
386 echo "--add mds --node localhost --mds mds1 --mkfsoptions \-\I\ \128" >> $BATCHFILE
387 # --mkfsoptions \-\I\ \128
388 do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
389 if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
390 echo "backslash followed by a whitespace/letter success"
392 echo "backslash followed by a whitespace/letter fail"
397 echo "--add net --node localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
398 echo "--add mds --node localhost --mds mds1 --mkfsoptions -I\ 128\\" >> $BATCHFILE
399 # --mkfsoptions -I\ 128\
400 do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
401 echo "backslash followed by nothing should return error"
404 XMLCONFIG=$OLDXMLCONFIG
406 run_test 12 "lmc --batch, with single/double quote, backslash in batchfile"
409 OLDXMLCONFIG=$XMLCONFIG
410 XMLCONFIG="conf13-1.xml"
411 SECONDXMLCONFIG="conf13-2.xml"
413 # check long uuid will be truncated properly and uniquely
414 echo "To generate XML configuration file(with long ost name): $XMLCONFIG"
415 [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
416 do_lmc --add net --node localhost --nid localhost.localdomain --nettype tcp
417 do_lmc --add mds --node localhost --mds mds1_name_longer_than_31characters
418 do_lmc --add mds --node localhost --mds mds2_name_longer_than_31characters
419 if [ ! -f "$XMLCONFIG" ]; then
420 echo "Error:no file $XMLCONFIG created!"
423 EXPECTEDMDS1UUID="e_longer_than_31characters_UUID"
424 EXPECTEDMDS2UUID="longer_than_31characters_UUID_2"
425 FOUNDMDS1UUID=`awk -F"'" '/<mds uuid=/{print $2}' $XMLCONFIG | sed -n '1p'`
426 FOUNDMDS2UUID=`awk -F"'" '/<mds uuid=/{print $2}' $XMLCONFIG | sed -n '2p'`
427 if [ $EXPECTEDMDS1UUID != $FOUNDMDS1UUID ]; then
428 echo "Error:expected uuid for mds1: $EXPECTEDMDS1UUID; found: $FOUNDMDS1UUID"
431 if [ $EXPECTEDMDS2UUID != $FOUNDMDS2UUID ]; then
432 echo "Error:expected uuid for mds2: $EXPECTEDMDS2UUID; found: $FOUNDMDS2UUID"
435 echo "Success:long uuid truncated successfully and being unique."
437 # check multiple invocations for lmc generate same XML configuration file
439 echo "Generate the first XML configuration file"
441 echo "mv $XMLCONFIG to $SECONDXMLCONFIG"
442 mv $XMLCONFIG $SECONDXMLCONFIG || return $?
443 echo "Generate the second XML configuration file"
445 if [ `diff $XMLCONFIG $SECONDXMLCONFIG | wc -l` -eq 0 ]; then
446 echo "Success:multiple invocations for lmc generate same XML file"
448 echo "Error: multiple invocations for lmc generate different XML file"
453 rm -f $SECONDXMLCONFIG
454 XMLCONFIG=$OLDXMLCONFIG
456 run_test 13 "check new_uuid of lmc operating correctly"
461 # create xml file with --mkfsoptions for ost
462 echo "create xml file with --mkfsoptions for ost"
463 add_mds mds --dev $MDSDEV --size $MDSSIZE
464 add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
465 --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
466 add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE \
467 --mkfsoptions "-Llabel_conf_15"
468 add_client client mds --lov lov1 --path $MOUNT
470 FOUNDSTRING=`awk -F"<" '/<mkfsoptions>/{print $2}' $XMLCONFIG`
471 EXPECTEDSTRING="mkfsoptions>-Llabel_conf_15"
472 if [ $EXPECTEDSTRING != $FOUNDSTRING ]; then
473 echo "Error: expected: $EXPECTEDSTRING; found: $FOUNDSTRING"
476 echo "Success:mkfsoptions for ost written to xml file correctly."
478 # mount lustre to test lconf mkfsoptions-parsing
482 mount_client $MOUNT || return $?
483 if [ -z "`dumpe2fs -h $OSTDEV | grep label_conf_15`" ]; then
484 echo "Error: the mkoptions not applied to mke2fs of ost."
488 echo "lconf mkfsoptions for ost success"
492 run_test 14 "test mkfsoptions of ost for lmc and lconf"