3 # This script is used to test large size LUN support in Lustre.
5 ################################################################################
8 LUSTRE=${LUSTRE:-$(cd $(dirname $0)/..; echo $PWD)}
9 . $LUSTRE/tests/test-framework.sh
11 . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh}
14 # Variable to run mdsrate
15 THREADS_PER_CLIENT=${THREADS_PER_CLIENT:-5} # thread(s) per client node
16 MACHINEFILE=${MACHINEFILE:-$TMP/$TESTSUITE.machines}
17 NODES_TO_USE=${NODES_TO_USE:-$CLIENTS}
18 NUM_CLIENTS=$(get_node_count ${NODES_TO_USE//,/ })
21 ALWAYS_EXCEPT="$LARGE_LUN_EXCEPT"
24 LARGE_LUN_RESTORE_MOUNT=false
25 if is_mounted $MOUNT || is_mounted $MOUNT2; then
26 LARGE_LUN_RESTORE_MOUNT=true
28 # Unmount and cleanup the Lustre filesystem
32 FULL_MODE=${FULL_MODE:-false}
33 RUN_FSCK=${RUN_FSCK:-true}
34 # if SLOW=yes, enable the FULL_MODE
35 [[ $SLOW = yes ]] && FULL_MODE=true
36 #########################################################################
37 # Dump the super block information for the filesystem present on device.
42 log "dump the super block information on $facet device $dev"
43 local cmd="$DUMPE2FS -h $dev"
44 do_facet $facet "$cmd"
47 # Report Lustre filesystem disk space usage and inodes usage of each MDT/OST.
56 cmd="lfs df -h $mnt_pnt"
60 cmd="lfs df -i $mnt_pnt"
65 # Cleanup the directories and files created by llverfs utility.
68 local mnt=${2:-$MOUNT}
69 local cmd="rm -rf $mnt/{*.filecount,dir*}"
70 do_facet $target "$cmd"
75 generate_machine_file $NODES_TO_USE $MACHINEFILE ||
76 error "can not generate machinefile"
78 # set the default stripe count for files in this test to one
79 local testdir=$MOUNT/mdsrate
82 $LFS setstripe $testdir -i 0 -c 1
85 local num_dirs=$THREADS_PER_CLIENT
86 [[ $num_dirs -eq 0 ]] && num_dirs=1
87 local free_inodes=$(lfs df -i $MOUNT | grep "OST:0" | awk '{print $4}')
89 num_files=$((free_inodes / num_dirs))
91 local command="$MDSRATE $MDSRATE_DEBUG --create --verbose \
92 --ndirs $num_dirs --dirfmt '$testdir/dir%d' \
93 --nfiles $num_files --filefmt 'file%%d'"
96 mpi_run -np $((NUM_CLIENTS * THREADS_PER_CLIENT)) -machinefile \
99 if [ ${PIPESTATUS[0]} != 0 ]; then
100 error "mdsrate create failed"
104 # Run e2fsck on MDS and OST
108 run_e2fsck $(facet_host $SINGLEMDS) $(mdsdevname ${SINGLEMDS//mds/}) \
109 "-y" || error "run e2fsck error"
110 for num in $(seq $OSTCOUNT); do
111 dev=$(ostdevname $num)
112 run_e2fsck $(facet_host ost${num}) $dev "-y" ||
113 error "run e2fsck error"
116 ################################## Main Flow ###################################
121 for num in $(seq $OSTCOUNT); do
122 dev=$(ostdevname $num)
123 log "run llverdev on the OST $dev"
124 do_rpc_nodes $(facet_host ost${num}) run_llverdev $dev -vpf ||
125 error "llverdev on $dev failed!"
128 run_test 1 "run llverdev on raw LUN"
134 for num in $(seq $OSTCOUNT); do
135 dev=$(ostdevname $num)
136 ostmnt=$(facet_mntpt ost${num})
138 # Mount the OST as an ldiskfs filesystem.
139 log "mount the OST $dev as a ldiskfs filesystem"
140 add ost${num} $(mkfs_opts ost${num}) $FSTYPE_OPT --reformat \
141 $(ostdevname $num) > /dev/null ||
142 error "format ost${num} error"
143 run_dumpe2fs ost${num} $dev
144 do_facet ost${num} mount -t $(facet_fstype ost${num}) $dev \
145 $ostmnt "$OST_MOUNT_OPTS"
147 # Run llverfs on the mounted ldiskfs filesystem in partial mode
148 # to ensure that the kernel can perform filesystem operations
149 # on the complete device without any errors.
150 log "run llverfs in partial mode on the OST ldiskfs $ostmnt"
151 do_rpc_nodes $(facet_host ost${num}) run_llverfs $ostmnt -vpl \
152 "no" || error "run_llverfs error on ldiskfs"
155 log "unmount the OST $dev"
158 # After llverfs is run on the ldiskfs filesystem in partial
159 # mode, a full e2fsck should be run to catch any errors early.
160 $RUN_FSCK && run_e2fsck $(facet_host ost${num}) $dev "-y" ||
161 error "run e2fsck error"
164 log "full mode, mount the OST $dev as a ldiskfs again"
165 do_facet ost${num} mount -t $(facet_fstype ost${num}) \
166 $dev $ostmnt "$OST_MOUNT_OPTS"
167 cleanup_dirs ost${num} $ostmnt
168 do_facet ost${num} "sync"
170 run_dumpe2fs ost${num} $dev
172 # Run llverfs on the mounted ldiskfs filesystem in full
173 # mode to ensure that the kernel can perform filesystem
174 # operations on the complete device without any errors.
175 log "run llverfs in full mode on OST ldiskfs $ostmnt"
176 do_rpc_nodes $(facet_host ost${num}) run_llverfs \
178 error "run_llverfs error on ldiskfs"
181 log "unmount the OST $dev"
184 # After llverfs is run on the ldiskfs filesystem in
185 # full mode, a full e2fsck should be run to catch any
187 $RUN_FSCK && run_e2fsck $(facet_host ost${num}) $dev \
188 "-y" || error "run e2fsck error"
192 run_test 2 "run llverfs on OST ldiskfs filesystem"
195 [ -z "$CLIENTS" ] && skip_env "CLIENTS not defined, skipping" && return
196 [ -z "$MPIRUN" ] && skip_env "MIPRUN not defined, skipping" && return
197 [ -z "$MDSRATE" ] && skip_env "MDSRATE not defined, skipping" && return
198 [ ! -x $MDSRATE ] && skip_env "$MDSRATE not built, skipping" && return
199 # Setup the Lustre filesystem.
200 log "setup the lustre filesystem"
201 REFORMAT="yes" check_and_setup_lustre
203 log "run mdsrate to use up the free inodes."
204 # Run the mdsrate test suite.
212 run_test 3 "use up free inodes on the OST with mdsrate"
215 # Setup the Lustre filesystem.
216 log "setup the lustre filesystem"
217 REFORMAT="yes" check_and_setup_lustre
220 for num in $(seq $OSTCOUNT); do
221 dev=$(ostdevname $num)
222 run_dumpe2fs ost${num} $dev
225 # Run llverfs on the mounted Lustre filesystem both in partial and
226 # full mode to to fill the filesystem and verify the file contents.
227 log "run llverfs in partial mode on the Lustre filesystem $MOUNT"
228 run_llverfs $MOUNT -vp "no" || error "run_llverfs error on lustre"
236 # Setup the Lustre filesystem again.
237 log "setup the lustre filesystem again"
240 cleanup_dirs client $MOUNT
244 for num in $(seq $OSTCOUNT); do
245 dev=$(ostdevname $num)
246 run_dumpe2fs ost${num} $dev
249 log "run llverfs in full mode on the Lustre filesystem $MOUNT"
250 run_llverfs $MOUNT -vl "no" ||
251 error "run_llverfs error on lustre"
259 run_test 4 "run llverfs on lustre filesystem"
262 $LARGE_LUN_RESTORE_MOUNT && setupall
263 check_and_cleanup_lustre