Whamcloud - gitweb
Branch b1_4_mountconf
[fs/lustre-release.git] / lustre / tests / llog-test.sh
1 #!/bin/sh
2
3 set -e
4
5 LUSTRE=${LUSTRE:-`dirname $0`/..}
6 . $LUSTRE/tests/test-framework.sh
7
8 init_test_env $@
9
10 . ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
11
12 ostfailover_HOST=${ostfailover_HOST:-$ost_HOST}
13
14 gen_config() {
15     rm -f "$XMLCONFIG"
16     add_mds mds --dev "$MDSDEV" --size "$MDSSIZE"
17     add_lov lov1 mds --stripe_sz $STRIPE_BYTES \
18         --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
19     add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE --failover
20     if [ ! -z "$ostfailover_HOST" ]; then
21          add_ostfailover ost --dev $OSTDEV --size $OSTSIZE
22     fi
23     add_client client mds --lov lov1 --path $MOUNT
24 }
25
26 cleanup() {
27     # make sure we are using the primary MDS, so the config log will
28     # be able to clean up properly.
29     activeost=`facet_active ost`
30     if [ $activeost != "ost" ]; then
31         fail ost
32     fi
33     zconf_umount `hostname` $MOUNT
34     stop mds ${FORCE} $MDSLCONFARGS
35     stop ost ${FORCE} --dump $TMP/replay-ost-single-`hostname`.log
36 }
37
38 if [ "$ONLY" == "cleanup" ]; then
39     sysctl -w portals.debug=0
40     FORCE=--force cleanup
41     exit
42 fi
43
44 build_test_filter
45
46 SETUP=${SETUP:-"setup"}
47 CLEANUP=${CLEANUP:-"cleanup"}
48
49 setup() {
50     gen_config
51
52     start ost --reformat $OSTLCONFARGS
53     [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
54     start mds --reformat $MDSLCONFARGS
55
56     if [ -z "`grep " $MOUNT " /proc/mounts`" ]; then
57         # test "-1" needed during initial client->OST connection
58         log "== test 00: target handle mismatch (bug 5317) === `date +%H:%M:%S`"
59
60         #define OBD_FAIL_OST_ALL_REPLY_NET       0x211
61         do_facet ost "sysctl -w lustre.fail_loc=0x80000211"
62
63         zconf_mount `hostname` $MOUNT && df $MOUNT && pass || error "mount fail"
64     fi
65 }
66
67 mkdir -p $DIR
68
69 $SETUP
70
71 LCOUNT=${LCOUNT:-10000}
72
73 test_0() {
74     ./createmany -o $DIR/llog-%d $LCOUNT
75     #replay_barrier ost
76 }
77 run_test 0 "Prepare fileset"
78
79 test_1() {
80     ./chownmany 1000 $DIR/llog-%d $LCOUNT
81     sleep 5
82 }
83 run_test 1 "Do chowns"
84
85 test_2() {
86     HALFCOUNT=${HALFCOUNT:-17}
87     ./chownmany 500 $DIR/llog-%d 0 $HALFCOUNT
88     fail ost
89     ./chownmany 500 $DIR/llog-%d $HALFCOUNT $LCOUNT
90     sleep 5
91 }
92 #run_test 2 "Fail OST during chown"
93
94 test_3() {
95     ./unlinkmany $DIR/llog-%d $LCOUNT
96     sleep 2
97     $CHECKSTAT -t file $DIR/llog-* && return 1 || true
98 }
99 run_test 3 "Remove testset"
100
101 equals_msg test complete, cleaning up
102 FORCE=--force $CLEANUP