-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_validate
executable file
·120 lines (104 loc) · 2.57 KB
/
run_validate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
set -e
usage(){
cat <<EOUSAGE
Usage: $(basename -- $0) [-a] [-t=<template>] [-h|--help]
Usage: $(basename -- $0) <block_device>
Used for validation of SSDs, runs the following set of tests:
- pre-fill the device sequentially with random data.
- run a set of tests:
- latency - 4k/8k random read / random write single queue depth
- sequential - 1M read/write queue depth of 32
- random - 4k/8k read/write/mixed (50/50) queue depth of 32
Installs perl and fio dependencies if needed.
[-h] - prints this help message.
EOUSAGE
}
if [ -n "$*" ]; then
while test -n "$1"; do
case "$1" in
-h|--help)
usage
exit
;;
-a)
autof=1
shift
;;
-t=*)
template=${1##*=}
echo "using template $template"
shift
;;
/dev/sd*|/dev/storpool/*|/dev/nvm*)
tvolume="$1"
shift
;;
*)
usage
exit 1
;;
esac
done
else
usage
exit 1
fi
chkdepend(){
local fio="$(which fio)"
if [[ ! -e $fio ]]; then
echo "Attempting to installing fio,perl dependencies"
if type -f yum 2>/dev/null; then
yum -y install epel-release perl-core
yum -y install fio
elif type -f apt-get 2>/dev/null; then
apt-get --yes install perl libdata-dump-perl
apt-get --yes install fio
else
echo 'Neither apt-get, nor yum found, OS not supported?'
exit 1
fi
fi
}
if [[ -n "$autof" ]]; then
if [[ -n $tvolume ]]; then
echo "Error: '-a' creates volume automatically, please remove it if you'd like to test on $tvolume" 1>&2
exit 1
fi
trap 'cleanup' EXIT INT QUIT TERM
echo 'Attempting to create test volume'
tname="test$$"
tvolume="/dev/storpool/$tname"
if [[ -z $template ]]; then
storpool volume "$tname" size 100G replication 3 placeAll hdd placeTail ssd
else
storpool volume "$tname" size 100G template "$template"
fi
storpool attach volume "$tname" here
fi
if [[ ! -b $tvolume ]]; then
echo "$tvolume is not a block device, exiting"
exit 1
fi
chkdepend
echo Regenerating templates
cd template
./rm_templates
./gen.pl
cd ..
tests=( fill fill fill lat-{r,w}-{4,8}k-1 rand-{r,rw,w}-{4,8}k-64 seq-{r,w}-1M-64 sustain )
echo Cleaning results directory
./rm_res
echo Running tests...
for test in ${tests[*]}; do
./run_one "$test" "$tvolume"
sleep 60
done
echo Displaying and saving result...
./get_res | sort | ./pretty_print
./get_res | sort >results.txt
model="$(/usr/lib/storpool/diskid-helper "$tvolume" | awk -F= '/MODEL/ { print $NF }')"
if [[ -n $model ]]; then
mkdir "$model" && mv ./sustain*log "$model" && echo "Logs moved to $model"
fi
echo Please use fplot.py to draw the sustain results.