Whamcloud - gitweb
ffd5b3033999062d3510fa6993fa75341989de0a
[fs/lustre-release.git] / lustre / tests / conf-sanity.sh
1 #!/bin/bash
2 # requirement:
3 #       add uml1 uml2 uml3 in your /etc/hosts
4
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.
9
10 set -e
11
12 SRCDIR=`dirname $0`
13 PATH=$PWD/$SRCDIR:$SRCDIR:$SRCDIR/../utils:$PATH
14
15 LUSTRE=${LUSTRE:-`dirname $0`/..}
16 RLUSTRE=${RLUSTRE:-$LUSTRE}
17 MOUNTLUSTRE=${MOUNTLUSTRE:-/sbin/mount.lustre}
18
19 . $LUSTRE/tests/test-framework.sh
20
21 init_test_env $@
22
23 . ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
24
25 gen_config() {
26         rm -f $XMLCONFIG
27
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
33 }
34
35 gen_second_config() {
36         rm -f $XMLCONFIG
37
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
43 }
44
45 start_mds() {
46         echo "start mds1 service on `facet_active_host mds1`"
47         start mds1 --reformat $MDSLCONFARGS  || return 94
48 }
49
50 stop_mds() {
51         echo "stop mds1 service on `facet_active_host mds1`"
52         stop mds1 $@ || return 97
53 }
54
55 start_ost() {
56         echo "start ost service on `facet_active_host ost`"
57         start ost --reformat $OSTLCONFARGS  || return 95
58 }
59
60 stop_ost() {
61         echo "stop ost service on `facet_active_host ost`"
62         stop ost $@ || return 98
63 }
64
65 mount_client() {
66         local MOUNTPATH=$1
67         echo "mount lustre on ${MOUNTPATH}....."
68         zconf_mount `hostname`  $MOUNTPATH  || return 96
69 }
70
71 umount_client() {
72         local MOUNTPATH=$1
73         echo "umount lustre on ${MOUNTPATH}....."
74         zconf_umount `hostname`  $MOUNTPATH || return 97
75 }
76
77 manual_umount_client(){
78         echo "manual umount lustre on ${MOUNTPATH}...."
79         do_facet  client "umount $MOUNT"
80 }
81
82 setup() {
83         start_ost
84         start_mds
85         mount_client $MOUNT
86 }
87
88 cleanup() {
89         umount_client $MOUNT || return 200
90         stop_mds || return 201
91         stop_ost || return 202
92         # catch case where these return just fine, but modules are still not unloaded
93         /sbin/lsmod | grep -q portals
94         if [ 1 -ne $? ]; then
95                 echo "modules still loaded..."
96                 return 203
97         fi
98 }
99
100 check_mount() {
101         do_facet client "touch $DIR/a" || return 71     
102         do_facet client "rm $DIR/a" || return 72        
103         echo "setup single mount lustre success"
104 }
105
106 check_mount2() {
107         do_facet client "touch $DIR/a" || return 71     
108         do_facet client "rm $DIR/a" || return 72        
109         do_facet client "touch $DIR2/a" || return 73    
110         do_facet client "rm $DIR2/a" || return 74       
111         echo "setup double mount lustre success"
112 }
113
114 build_test_filter
115
116 #create single point mountpoint
117
118 gen_config
119 start_krb5_kdc || exit 1
120 start_lsvcgssd || return 2
121 start_lgssd || return 3
122
123 test_0() {
124         start_ost
125         start_mds       
126         mount_client $MOUNT
127         check_mount || return 41
128         cleanup || return $?
129 }
130 run_test 0 "single mount setup"
131
132 test_1() {
133         start_ost
134         echo "start ost second time..."
135         start ost --reformat $OSTLCONFARGS
136         start_mds       
137         mount_client $MOUNT
138         check_mount || return 42
139         cleanup || return $?
140 }
141 run_test 1 "start up ost twice"
142
143 test_2() {
144         start_ost
145         start_mds       
146         echo "start mds second time.."
147         start mds1 --reformat $MDSLCONFARGS
148         
149         mount_client $MOUNT
150         check_mount || return 43
151         cleanup || return $?
152 }
153 run_test 2 "start up mds twice"
154
155 test_3() {
156         setup
157         mount_client $MOUNT
158
159         check_mount || return 44
160         
161         umount_client $MOUNT    
162         cleanup  || return $?
163 }
164 run_test 3 "mount client twice"
165
166 test_4() {
167         setup
168         touch $DIR/$tfile || return 85
169         stop_ost --force
170         cleanup
171         eno=$?
172         # ok for ost to fail shutdown
173         if [ 202 -ne $eno ]; then
174                 return $eno;
175         fi
176         return 0
177 }
178 run_test 4 "force cleanup ost, then cleanup"
179
180 test_5() {
181         setup
182         touch $DIR/$tfile || return 1
183         stop_mds --force || return 2
184
185         # cleanup may return an error from the failed
186         # disconnects; for now I'll consider this successful
187         # if all the modules have unloaded.
188
189         # as MDS is down, umount without -f may cause blocking
190         # and this test will never finish. Blocking is possible
191         # as umount may want to cancel locks with RPC's and these
192         # RPC's will wait forever, as pinger thread will try to
193         # recover failed import endlessly.
194         #
195         # Thus, main point is: nobody should expect umount finish
196         # quickly and cleanly without -f flag when MDS or OST is 
197         # down for sure. --umka
198         umount -f $MOUNT &
199         UMOUNT_PID=$!
200         sleep 2
201         echo "killing umount"
202         kill -TERM $UMOUNT_PID
203         echo "waiting for umount to finish"
204         wait $UMOUNT_PID
205
206         # cleanup client modules
207         $LCONF --force --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
208         
209         # stop_mds is a no-op here, and should not fail
210         stop_mds || return 4
211         
212         # this should have --force flag specified, as umount -f
213         # will skip disconnect phase and thus OST will have one
214         # extra refcount what will cause class_cleanup() failure
215         # if --force is not specified. --umka
216         stop_ost --force || return 5
217
218         lsmod | grep -q portals && return 6
219         return 0
220 }
221 run_test 5 "force cleanup mds, then cleanup --force"
222
223 test_5b() {
224         start_ost
225         start_mds
226         stop_mds
227
228         [ -d $MOUNT ] || mkdir -p $MOUNT
229         $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
230         llmount -o nettype=$NETTYPE $mds_HOST://mds_svc/client_facet $MOUNT  && exit 2
231
232         # cleanup client modules
233         $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
234         
235         # stop_mds is a no-op here, and should not fail
236         stop_mds || return 3
237         stop_ost || return 4
238
239         lsmod | grep -q portals && return 5
240         return 0
241
242 }
243 run_test 5b "mds down, cleanup after failed mount (bug 2712)"
244
245 test_5c() {
246         start_ost
247         start_mds
248
249         [ -d $MOUNT ] || mkdir -p $MOUNT
250         $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
251         llmount -o nettype=$NETTYPE $mds_HOST://wrong_mds_svc/client_facet $MOUNT  && return 2
252
253         # cleanup client modules
254         $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
255         
256         stop_mds || return 3
257         stop_ost || return 4
258
259         lsmod | grep -q portals && return 5
260         return 0
261
262 }
263 run_test 5c "cleanup after failed mount (bug 2712)"
264
265 test_5d() {
266        start_ost
267        start_mds
268        stop_ost --force
269
270        [ -d $MOUNT ] || mkdir -p $MOUNT
271        $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null
272        llmount -o nettype=$NETTYPE $mds_HOST://mds1_svc/client_facet $MOUNT  || return 1
273
274        umount $MOUNT || return 2
275        # cleanup client modules
276        $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null
277
278        stop_mds || return 3
279
280        lsmod | grep -q portals && return 4
281        return 0
282
283 }
284 run_test 5d "ost down, don't crash during mount attempt"
285
286 test_6() {
287         setup
288         manual_umount_client
289         mount_client ${MOUNT} || return 87
290         touch $DIR/a || return 86
291         cleanup  || return $?
292 }
293 run_test 6 "manual umount, then mount again"
294
295 test_7() {
296         setup
297         manual_umount_client
298         cleanup || return $?
299 }
300 run_test 7 "manual umount, then cleanup"
301
302 test_8() {
303         start_ost
304         start_mds
305
306         mount_client $MOUNT
307         mount_client $MOUNT2
308
309         check_mount2 || return 45
310         umount $MOUNT
311         umount_client $MOUNT2
312         
313         stop_mds
314         stop_ost
315 }
316 run_test 8 "double mount setup"
317
318 test_9() {
319         # backup the old values of PTLDEBUG and SUBSYSTEM
320         OLDPTLDEBUG=$PTLDEBUG
321         OLDSUBSYSTEM=$SUBSYSTEM
322
323         # generate new configuration file with lmc --ptldebug and --subsystem
324         PTLDEBUG="trace"
325         SUBSYSTEM="mdc"
326         gen_config
327
328         # check the result of lmc --ptldebug/subsystem
329         start_ost
330         start_mds
331         mount_client $MOUNT
332         CHECK_PTLDEBUG="`cat /proc/sys/portals/debug`"
333         if [ $CHECK_PTLDEBUG = "1" ]; then
334            echo "lmc --debug success"
335         else
336            echo "lmc --debug: want 1, have $CHECK_PTLDEBUG"
337            return 1
338         fi
339         CHECK_SUBSYSTEM="`cat /proc/sys/portals/subsystem_debug`"
340         if [ $CHECK_SUBSYSTEM = "2" ]; then
341            echo "lmc --subsystem success"
342         else
343            echo "lmc --subsystem: want 2, have $CHECK_SUBSYSTEM"
344            return 1
345         fi
346         check_mount || return 41
347         cleanup || return $?
348
349         # the new PTLDEBUG/SUBSYSTEM used for lconf --ptldebug/subsystem
350         PTLDEBUG="inode+trace"
351         SUBSYSTEM="mds+ost"
352
353         # check lconf --ptldebug/subsystem overriding lmc --ptldebug/subsystem
354         start_ost
355         start_mds
356         CHECK_PTLDEBUG="`do_facet mds1 sysctl portals.debug | cut -d= -f2`"
357         if [ $CHECK_PTLDEBUG = "3" ]; then
358            echo "lconf --debug success"
359         else
360            echo "lconf --debug: want 3, have $CHECK_PTLDEBUG"
361            return 1
362         fi
363         CHECK_SUBSYS="`do_facet mds1 sysctl portals.subsystem_debug|cut -d= -f2`"
364         if [ $CHECK_SUBSYS = "20" ]; then
365            echo "lconf --subsystem success"
366         else
367            echo "lconf --subsystem: want 20, have $CHECK_SUBSYS"
368            return 1
369         fi
370         mount_client $MOUNT
371         check_mount || return 41
372         cleanup || return $?
373
374         # resume the old configuration
375         PTLDEBUG=$OLDPTLDEBUG
376         SUBSYSTEM=$OLDSUBSYSTEM
377         gen_config
378 }
379
380 run_test 9 "test --ptldebug and --subsystem for lmc and lconf"
381
382 test_10() {
383         echo "generate configuration with the same name for node and mds"
384         OLDXMLCONFIG=$XMLCONFIG
385         XMLCONFIG="broken.xml"
386         [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
387         facet="mds1"
388         rm -f ${facet}active
389         add_facet $facet
390         echo "the name for node and mds is the same"
391         do_lmc --add mds --node ${facet}_facet --mds ${facet}_facet \
392             --dev $MDSDEV --size $MDSSIZE || return $?
393         do_lmc --add lov --mds ${facet}_facet --lov lov1 --stripe_sz \
394             $STRIPE_BYTES --stripe_cnt $STRIPES_PER_OBJ \
395             --stripe_pattern 0 || return $?
396         add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE
397         facet="client"
398         add_facet $facet --lustre_upcall $UPCALL
399         do_lmc --add mtpt --node ${facet}_facet --mds mds1_facet \
400             --lov lov1 --path $MOUNT
401
402         echo "mount lustre"
403         start_ost
404         start_mds
405         mount_client $MOUNT
406         check_mount || return 41
407         cleanup || return $?
408
409         echo "Success!"
410         XMLCONFIG=$OLDXMLCONFIG
411 }
412 run_test 10 "mount lustre with the same name for node and mds"
413
414 test_11() {
415         OLDXMLCONFIG=$XMLCONFIG
416         XMLCONFIG="conf11.xml"
417
418         [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
419         add_mds mds1 --dev $MDSDEV --size $MDSSIZE
420         add_ost ost --dev $OSTDEV --size $OSTSIZE
421         add_client client mds1 --path $MOUNT --ost ost_svc || return $?
422         echo "Default lov config success!"
423
424         [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
425         add_mds mds1 --dev $MDSDEV --size $MDSSIZE
426         add_ost ost --dev $OSTDEV --size $OSTSIZE
427         add_client client mds1 --path $MOUNT && return $?
428         echo "--add mtpt with neither --lov nor --ost will return error"
429
430         echo ""
431         echo "Success!"
432         XMLCONFIG=$OLDXMLCONFIG
433 }
434 run_test 11 "use default lov configuration (should return error)"
435
436 test_12() {
437         OLDXMLCONFIG=$XMLCONFIG
438         XMLCONFIG="batch.xml"
439         BATCHFILE="batchfile"
440
441         # test double quote
442         [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
443         [ -f "$BATCHFILE" ] && rm -f $BATCHFILE
444         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
445         echo "--add mds --node localhost --mds mds1 --mkfsoptions \"-I 128\"" >> $BATCHFILE
446         # --mkfsoptions "-I 128"
447         do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
448         if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
449                 echo "matched double quote success"
450         else
451                 echo "matched double quote fail"
452                 return 1
453         fi
454         rm -f $XMLCONFIG
455         rm -f $BATCHFILE
456         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
457         echo "--add mds --node localhost --mds mds1 --mkfsoptions \"-I 128" >> $BATCHFILE
458         # --mkfsoptions "-I 128
459         do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
460         echo "unmatched double quote should return error"
461
462         # test single quote
463         rm -f $BATCHFILE
464         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
465         echo "--add mds --node localhost --mds mds1 --mkfsoptions '-I 128'" >> $BATCHFILE
466         # --mkfsoptions '-I 128'
467         do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
468         if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
469                 echo "matched single quote success"
470         else
471                 echo "matched single quote fail"
472                 return 1
473         fi
474         rm -f $XMLCONFIG
475         rm -f $BATCHFILE
476         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
477         echo "--add mds --node localhost --mds mds1 --mkfsoptions '-I 128" >> $BATCHFILE
478         # --mkfsoptions '-I 128
479         do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
480         echo "unmatched single quote should return error"
481
482         # test backslash
483         rm -f $BATCHFILE
484         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
485         echo "--add mds --node localhost --mds mds1 --mkfsoptions \-\I\ \128" >> $BATCHFILE
486         # --mkfsoptions \-\I\ \128
487         do_lmc -m $XMLCONFIG --batch $BATCHFILE || return $?
488         if [ `sed -n '/>-I 128</p' $XMLCONFIG | wc -l` -eq 1 ]; then
489                 echo "backslash followed by a whitespace/letter success"
490         else
491                 echo "backslash followed by a whitespace/letter fail"
492                 return 1
493         fi
494         rm -f $XMLCONFIG
495         rm -f $BATCHFILE
496         echo "--add net --node  localhost --nid localhost.localdomain --nettype tcp" > $BATCHFILE
497         echo "--add mds --node localhost --mds mds1 --mkfsoptions -I\ 128\\" >> $BATCHFILE
498         # --mkfsoptions -I\ 128\
499         do_lmc -m $XMLCONFIG --batch $BATCHFILE && return $?
500         echo "backslash followed by nothing should return error"
501
502         rm -f $BATCHFILE
503         XMLCONFIG=$OLDXMLCONFIG
504 }
505 run_test 12 "lmc --batch, with single/double quote, backslash in batchfile"
506
507 test_13() {
508         OLDXMLCONFIG=$XMLCONFIG
509         XMLCONFIG="conf13-1.xml"
510         SECONDXMLCONFIG="conf13-2.xml"
511
512         # check long uuid will be truncated properly and uniquely
513         echo "To generate XML configuration file(with long ost name): $XMLCONFIG"
514         [ -f "$XMLCONFIG" ] && rm -f $XMLCONFIG
515         do_lmc --add net --node localhost --nid localhost.localdomain --nettype tcp
516         do_lmc --add mds --node localhost --mds mds1_name_longer_than_31characters
517         do_lmc --add mds --node localhost --mds mds2_name_longer_than_31characters
518         if [ ! -f "$XMLCONFIG" ]; then
519                 echo "Error:no file $XMLCONFIG created!"
520                 return 1
521         fi
522         EXPECTEDMDS1UUID="e_longer_than_31characters_UUID"
523         EXPECTEDMDS2UUID="longer_than_31characters_UUID_2"
524         FOUNDMDS1UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '1p' \
525                        | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
526         FOUNDMDS2UUID=`awk -F"'" '/<mds .*uuid=/' $XMLCONFIG | sed -n '2p' \
527                        | sed "s/ /\n\r/g" | awk -F"'" '/uuid=/{print $2}'`
528         if ([ $EXPECTEDMDS1UUID = $FOUNDMDS1UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS2UUID ]) || \
529            ([ $EXPECTEDMDS1UUID = $FOUNDMDS2UUID ] && [ $EXPECTEDMDS2UUID = $FOUNDMDS1UUID ]); then
530                 echo "Success:long uuid truncated successfully and being unique."
531         else
532                 echo "Error:expected uuid for mds1 and mds2: $EXPECTEDMDS1UUID; $EXPECTEDMDS2UUID"
533                 echo "but:     found uuid for mds1 and mds2: $FOUNDMDS1UUID; $FOUNDMDS2UUID"
534                 return 1
535         fi
536
537         # check multiple invocations for lmc generate same XML configuration file
538         rm -f $XMLCONFIG
539         echo "Generate the first XML configuration file"
540         gen_config
541         echo "mv $XMLCONFIG to $SECONDXMLCONFIG"
542         mv $XMLCONFIG $SECONDXMLCONFIG || return $?
543         echo "Generate the second XML configuration file"
544         gen_config
545         if [ `diff $XMLCONFIG $SECONDXMLCONFIG | wc -l` -eq 0 ]; then
546                 echo "Success:multiple invocations for lmc generate same XML file"
547         else
548                 echo "Error: multiple invocations for lmc generate different XML file"
549                 return 1
550         fi
551
552         rm -f $XMLCONFIG
553         rm -f $SECONDXMLCONFIG
554         XMLCONFIG=$OLDXMLCONFIG
555 }
556 run_test 13 "check new_uuid of lmc operating correctly"
557
558 test_14() {
559         rm -f $XMLCONFIG
560
561         # create xml file with --mkfsoptions for ost
562         echo "create xml file with --mkfsoptions for ost"
563         add_mds mds1 --dev $MDSDEV --size $MDSSIZE
564         add_lov lov1 mds1 --stripe_sz $STRIPE_BYTES\
565             --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
566         add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE \
567             --mkfsoptions "-Llabel_conf_14"
568         add_client client mds1 --lov lov1 --path $MOUNT
569
570         FOUNDSTRING=`awk -F"<" '/<mkfsoptions>/{print $2}' $XMLCONFIG`
571         EXPECTEDSTRING="mkfsoptions>-Llabel_conf_14"
572         if [ $EXPECTEDSTRING != $FOUNDSTRING ]; then
573                 echo "Error: expected: $EXPECTEDSTRING; found: $FOUNDSTRING"
574                 return 1
575         fi
576         echo "Success:mkfsoptions for ost written to xml file correctly."
577
578         # mount lustre to test lconf mkfsoptions-parsing
579         echo "mount lustre"
580         start_ost
581         start_mds
582         mount_client $MOUNT || return $?
583         if [ -z "`dumpe2fs -h $OSTDEV | grep label_conf_14`" ]; then
584                 echo "Error: the mkoptions not applied to mke2fs of ost."
585                 return 1
586         fi
587         cleanup
588         echo "lconf mkfsoptions for ost success"
589
590         gen_config
591 }
592 run_test 14 "test mkfsoptions of ost for lmc and lconf"
593
594 cleanup_15() {
595         trap 0
596         [ -f $MOUNTLUSTRE ] && echo "remove $MOUNTLUSTRE" && rm -f $MOUNTLUSTRE
597         if [ -f $MOUNTLUSTRE.sav ]; then
598                 echo "return original $MOUNTLUSTRE.sav to $MOUNTLUSTRE"
599                 mv $MOUNTLUSTRE.sav $MOUNTLUSTRE
600         fi
601 }
602
603 test_15() {
604         start_ost
605         start_mds
606         echo "mount lustre on ${MOUNT} with $MOUNTLUSTRE....."
607         if [ -f "$MOUNTLUSTRE" ]; then
608                 echo "save $MOUNTLUSTRE to $MOUNTLUSTRE.sav"
609                 mv $MOUNTLUSTRE $MOUNTLUSTRE.sav
610         fi
611         [ -f "$MOUNTLUSTRE" ] && echo "can't move $MOUNTLUSTRE" && return 40
612         trap cleanup_15 EXIT INT
613         [ ! `cp $LUSTRE/utils/llmount $MOUNTLUSTRE` ] || return $?
614         do_node `hostname` mkdir -p $MOUNT 2> /dev/null
615         # load llite module on the client if it isn't in /lib/modules
616         do_node `hostname` $LCONF --nosetup --node client_facet $XMLCONFIG
617         do_node `hostname` mount -t lustre -o nettype=$NETTYPE \
618                 `facet_active_host mds1`:/mds1_svc/client_facet $MOUNT ||return $?
619         echo "mount lustre on $MOUNT with $MOUNTLUSTRE: success"
620         [ -d /r ] && $LCTL modules > /r/tmp/ogdb-`hostname`
621         check_mount || return 41
622         do_node `hostname` umount $MOUNT
623
624         [ -f "$MOUNTLUSTRE" ] && rm -f $MOUNTLUSTRE
625         echo "mount lustre on ${MOUNT} without $MOUNTLUSTRE....."
626         do_node `hostname` mount -t lustre -o nettype=$NETTYPE \
627                 `facet_active_host mds1`:/mds1_svc/client_facet $MOUNT &&return $?
628         echo "mount lustre on $MOUNT without $MOUNTLUSTRE failed as expected"
629         cleanup || return $?
630         cleanup_15
631 }
632 run_test 15 "zconf-mount without /sbin/mount.lustre (should return error)"
633
634 is_digit() {
635     local value=$1
636     echo $value | grep -q "^[[:digit:]]*$"
637     return $?
638 }
639
640 test_16() {
641         TMPMTPT="/mnt/conf16"
642                                                                                                                              
643         if [ ! -f "$MDSDEV" ]; then
644             echo "no $MDSDEV existing, so mount Lustre to create one"
645             start_ost
646             start_mds
647             mount_client $MOUNT
648             check_mount || return 41
649             cleanup || return $?
650         fi
651                                                                                                                              
652         echo "change the mode of $MDSDEV/OBJECTS,LOGS,PENDING to 555"
653         [ -d $TMPMTPT ] || mkdir -p $TMPMTPT
654         mount -o loop -t ext3 $MDSDEV $TMPMTPT || return $?
655         chmod 555 $TMPMTPT/OBJECTS || return $?
656         chmod 555 $TMPMTPT/LOGS || return $?
657         chmod 555 $TMPMTPT/PENDING || return $?
658         umount $TMPMTPT || return $?
659                                                                                                                              
660         echo "mount Lustre to change the mode of OBJECTS/LOGS/PENDING, then umount Lustre"
661         start_ost
662         start_mds
663         mount_client $MOUNT
664         check_mount || return 41
665         cleanup || return $?
666                                                                                                                              
667         echo "read the mode of OBJECTS/LOGS/PENDING and check if they has been changed properly"
668         EXPECTEDOBJECTSMODE=`debugfs -R "stat OBJECTS" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'`
669         EXPECTEDLOGSMODE=`debugfs -R "stat LOGS" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'`
670         EXPECTEDPENDINGMODE=`debugfs -R "stat PENDING" $MDSDEV 2> /dev/null | awk '/Mode: /{print $6}'`
671
672         # check if values are empty
673         test "x$EXPECTEDOBJECTSMODE" = "x" && EXPECTEDOBJECTSMODE="<empty>"
674         test "x$EXPECTEDLOGSMODE" = "x" && EXPECTEDLOGSMODE="<empty>"
675         test "x$EXPECTEDPENDINGMODE" = "x" && EXPECTEDPENDINGMODE="<empty>"
676
677         # check if values are valid digits
678         is_digit $EXPECTEDOBJECTSMODE || {
679             echo "Invalid OBJECTS mode obtained from debugfs: $EXPECTEDOBJECTSMODE"
680             return 42
681         }
682
683         is_digit $EXPECTEDLOGSMODE || {
684             echo "Invalid LOGS mode obtained from debugfs: $EXPECTEDLOGSMODE"
685             return 42
686         }
687
688         is_digit $EXPECTEDPENDINGMODE || {
689             echo "Invalid PINDING mode obtained from debugfs: $EXPECTEDPENDINGMODE"
690             return 42
691         }
692
693         # check if values are those we expected
694         if [ "x$EXPECTEDOBJECTSMODE" = "x0777" ]; then
695                 echo "Success: Lustre change the mode of OBJECTS correctly"
696         else
697                 echo "Error: Lustre does not change the mode of OBJECTS properly"
698                 echo "Expected value: 0777, actual one: $EXPECTEDOBJECTSMODE"
699                 return 1
700         fi
701                                                                                                                              
702         if [ "x$EXPECTEDLOGSMODE" = "x0777" ]; then
703                 echo "Success: Lustre change the mode of LOGS correctly"
704         else
705                 echo "Error: Lustre does not change the mode of LOGS properly"
706                 echo "Expected value: 0777, actual one: $EXPECTEDLOGSMODE"
707                 return 1
708         fi
709                                                                                                                              
710         if [ "x$EXPECTEDPENDINGMODE" = "x0777" ]; then
711                 echo "Success: Lustre change the mode of PENDING correctly"
712         else
713                 echo "Error: Lustre does not change the mode of PENDING properly"
714                 echo "Expected value: 0777, actual one: $EXPECTEDPENDINGMODE"
715                 return 1
716         fi
717 }
718 run_test 16 "verify that lustre will correct the mode of OBJECTS/LOGS/PENDING"
719
720 test_17() {
721         TMPMTPT="/mnt/conf17"
722
723         if [ ! -f "$MDSDEV" ]; then
724             echo "no $MDSDEV existing, so mount Lustre to create one"
725             start_ost
726             start_mds
727             mount_client $MOUNT
728             check_mount || return 41
729             cleanup || return $?
730         fi
731
732         echo "Remove mds config log"
733         [ -d $TMPMTPT ] || mkdir -p $TMPMTPT
734         mount -o loop -t ext3 $MDSDEV $TMPMTPT || return $?
735         rm -f $TMPMTPT/LOGS/mds1_svc || return $?
736         umount $TMPMTPT || return $?
737
738         start_ost
739         start mds1 $MDSLCONFARGS && return 42
740         cleanup || return $?
741 }
742 run_test 17 "Verify failed mds_postsetup won't fail assertion (2936)"
743
744 test_18() {
745         [ -f $MDSDEV ] && echo "remove $MDSDEV" && rm -f $MDSDEV
746         echo "mount mds with large journal..."
747         OLDMDSSIZE=$MDSSIZE
748         MDSSIZE=2000000
749         gen_config
750                                                                                                                              
751         echo "mount lustre system..."
752         start_ost
753         start_mds
754         mount_client $MOUNT
755         check_mount || return 41
756                                                                                                                              
757         echo "check journal size..."
758         FOUNDJOURNALSIZE=`debugfs -R "stat <8>" $MDSDEV | awk '/Size: / { print $6; exit;}'`
759         if [ $FOUNDJOURNALSIZE = "79691776" ]; then
760                 echo "Success:lconf creates large journals"
761         else
762                 echo "Error:lconf not create large journals correctly"
763                 echo "expected journal size: 79691776(76M), found journal size: $FOUNDJOURNALSIZE"
764                 return 1
765         fi
766                                                                                                                              
767         cleanup || return $?
768                                                                                                                              
769         MDSSIZE=$OLDMDSSIZE
770         gen_config
771 }
772 run_test 18 "check lconf creates large journals"
773
774 stop_lgssd
775 stop_lsvcgssd
776
777 equals_msg "Done"