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