-
Notifications
You must be signed in to change notification settings - Fork 0
/
vdbench_value.sh
executable file
·890 lines (780 loc) · 34.7 KB
/
vdbench_value.sh
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
#!/bin/bash
WRITE="write_test_"
READ="read_test_"
declare -A vdbench_params
declare -A log
declare -A testResultsData
declare -A directoryStracture
declare -A vdbenchResultsLog
declare -A vdbench
declare -A storageInfo
declare -A hostInfo
#### global variables
directoryStracture[absPath]="benchmark_results"
directoryStracture[bas]="benchmark_results"
log[timestamp]=$(date +%y%m%d_%H%M%S)
log[debug]="/tmp/vdbench.benchmark.debug.${log[timestamp]}.log"
log[verbose]="/tmp/vdbench.benchmark.verbose.${log[timestamp]}.log"
log[error]="/tmp/vdbench.benchmark.error.${log[timestamp]}.log"
log[results]="/tmp/vdbench.benchmark.${log[timestamp]}.log"
log[info]="/tmp/vdbench.benchmark.info.${log[timestamp]}.log"
log[logOutput]="vdbench.global.log"
vdbenchResultsLog[writetest]="write_test_"
vdbenchResultsLog[readtest]="read_test_"
vdbenchResultsLog[out]="out_"
storageInfo[json]="storageInfo.json"
storageInfo[remoteScriptsPath]="/home"
storageInfo[localScriptPath]="/usr/global/scripts/SVC"
storageInfo[mkVdisks]="mk_vdisks"
storageInfo[mkArray]="mk_arrays_master"
storageInfo[jsonFile]="storageInfo.json"
#### global params ####
hostInfo[totalOLFCount]="0" # total online FC count
hostInfo[totalOFFCount]="0" # total offline FC count
#### color sheame
printf "test time stemp %s\n" ${log[timestamp]}
wrap_color() {
text="$1"
shift
color "$@"
echo -n "$text"
color reset
echo
}
wrap_good() {
echo "$(wrap_color "$1" white): $(wrap_color "$2" green)"
}
wrap_bad() {
echo "$(wrap_color "$1" bold): $(wrap_color "$2" bold red)"
}
wrap_warning() {
wrap_color >&2 "$*" red
}
parse_parameter() {
if [[ $# < 1 ]]; then
usage
exit
fi
while [[ $# > 1 ]]
do
key="${1}"
shift
case "${key}" in
--hsrm )
vdbench_params[hsrm]="$1"
shift
;;
--hrdev)
vdbench_params[hrdev]="$1"
shift
;;
--cshost)
vdbench_params[cshost]="$1"
shift
;;
--csdev)
vdbench_params[csdev]="$1"
shift
;;
-vs | --volsize )
#volsize="$1"
storageInfo[volsize]="$1"
shift
;;
-vn | --volnum )
storageInfo[volnum]="$1"
shift
;;
-s | --stand-name )
storageInfo[stand_name]="$1"
shift
;;
-c | --clients)
vdbench_params[clients]="$1"
shift
;;
-th | --threads )
#thrades="$1"
vdbench[threads]="$1"
shift
;;
-bs | --blocksize )
#blocksize=( $1 )
vdbench[blocksize]=$1
shift
;;
-i | --interval )
#interval="$1"
vdbench[interval]="$1"
shift;;
-rd | --readdata )
#read_data="$1"
vdbench[readdata]="$1"
shift
;;
-wd | --writedata )
#write_data="$1"
vdbench[write_data]="$1"
shift
;;
-d | --debug )
log[debug]="true"
#debug="true"
shift
;;
-v | --verbose )
log[verbose]="true"
#verbose="true"
shift
;;
-vu | --volsizeunit )
#volsizeunit="$1"
storageInfo[volsizeunit]="$1"
shift
;;
-t | --type )
#type="$1"
storageInfo[type]="$1"
shift
;;
-vt | --voltype )
#voltype="$1"
storageInfo[voltype]="$1"
shift
;;
-rt | --raidtype)
storageInfo[raidtype]="$1"
;;
-cr | --cmprun )
vdbench[cmprun]="$1"
;;
--cleanenv )
vdbench_params[cleanenv]="true"
;;
-vd | --vdbin )
vdbench[vdbin]="$1"
;;
--help )
usage
;;
#*)
# usage
# ;;
esac
done
}
usage(){
echo -e "\
\tUsage:
\t $(basename $0) [ -c | --stand-name <storage name> ] [ -t | --type <xiv|svc> ] [ -c | --clients <client list> ] \r
\t[ -vs | --volsize <size> ] [ -vn | --volnum <vol number> ] [ -vu | --volsizeunit <GB|GiB> ] [ -vt | --voltype <cmp|fa> ] \r
\t[ -rd | --readdata <size> ] [ -wd | --writedata <size> ] [ -th | --threads <number> ] [ -bs | --blocksize <blocksize> ] \r
\t[ -cr | --cmprun <comp ratio> ] \r
\t[ -d | --debug ] [ -v | --verbose ]
Storage Arguments :
-s | --stand-name stand name : <no defaults>
-c | --clients clients test : <no defaults most>
-t | --type storage type : <default svc>
-vs | --volsize volume size : <default 488>
-vn | --volnum number of volume : <default 128>
-vu | --volsizeunit size unit type : < t|g|m > <default g >
-vt | --voltype run type compression or fully allocation : <default cmp>
-rd | --raidtype raid type for volume creation : <default raid10>
Vdbench Arguments :
-vd | --vdbin vdbench bin execution path
-wd | --writedata write data from storage : <default 3000g>
-rd | --readdata read data from storage : <default 1000g>
-th | --threads threads per lun : <default 4>
-bs | --blocksize test blocksize : <default 4k,8k,16k,32k etc> full scale
-cr | --cmprun test compression ratio : <default 30,50,65 etc> full scale
-i | --interval test results interval output display <defaul 10 sec>
Vdbench extra options:
--seekpct
--
other parameters :
--mail send results by mail : <default RTC_SVC>
--xlsx create excel file : <default disable>
--upload upload json file to par if no errors found
extra parameters :
--hsrm host storage remove : <default : yes>
--hrdev rescan host device : <default : yes>
--cshost create storage host : <default : yes>
--csdev create storage host : <default : yes>
debug info :
-b | --debug default false
-v | --verbose default false
Example: Creating 128 volums of 488 GB and attaching them 'wl9 wl10 wl11'\r
$(basename $0) -s rtc02t --volnum 128 --volsize 488 -c \"wl9 wl10 wl11\" -type svc"
}
checking_params()
{
if [[ ! {vdbench_params[vdbin]} ]]; then
printf "using default path to vdbench test"
vdbench[vdbin]="/root/vdbench"
fi
if [[ ! ${storageInfo[stand_name]} ]];then
printf "ERRROR : STORAGE NOT DEFINED!!!!!! \n "
usage
exit
fi
if [[ ! ${vdbench_params[clients]} ]];then
printf "ERRROR : CLIENTS NOT DEFINED!!!!!! \n "
usage
exit
fi
if [[ ! ${vdbench_params[hsrm]} ]]; then
vdbench[hsrm]="true" # hsot storage remove
fi
if [[ ! ${vdbench_params[hrdev]} ]]; then
vdbench[hrdev]="true" # host remove devices
fi
if [[ ! ${vdbench_params[cshost]} ]]; then
vdbench[cshost]="true"
fi
if [[ ! ${vdbench_params[csdev]} ]]; then
vdbench[csdev]="true"
fi
if [[ ! ${storageInfo[volsizeunit]} ]];then
storageInfo[volsizeunit]="g"
fi
if [[ ! ${storageInfo[volnum]} ]];then
storageInfo[volnum]="128"
fi
if [[ ! ${vdbench[threads]} ]] ;
then
vdbench["threads"]="4"
fi
if [[ ! ${vdbench[blocksize]} ]]; then
vdbench[blocksize]=""1024k" "512k" "256k" "128k" "64k" "32k" "16k" "8k" "4k""
#printf "setting default value to [ blocksize ] %s \n " "${vdbench_params[blocksize]}"
fi
if [[ ! ${storageInfo[volsize]} ]];then
storageInfo[volsize]="488"
fi
if [[ ! ${storageInfo[vol_num]} ]];then
storageInfo[vol_num]="128"
fi
if [[ ! ${vdbench[interval]} ]];then
vdbench[interval]="10"
fi
if [[ ! ${vdbench[read_data]} ]];then
vdbench[read_data]="1000g"
fi
if [[ ! ${vdbench[write_data]} ]];then
vdbench[write_data]="3000g"
fi
if [[ ! ${vdbench[cmprun]} ]]; then
vdbench[cmprun]=" "1.3" "1.7" "2.3" "3.5" "11" "
fi
if [[ ! ${log[debug]} ]];then
log[debug]="false"
printf "debug not defined %s\n" ${log[debug]}
fi
if [[ ! ${log[verbose]} ]];then
log[verbose]="false"
printf "verbose not defined %s\n" ${log[verbose]}
fi
if [[ ! ${storageInfo[voltype]} ]];then
# storageInfo[voltype]="cmp"
storageInfo[voltype]="COMPRESSED"
fi
if [[ ! ${storageInfo[raidType]} ]] ; then
storageInfo[raidType]="raid5"
fi
if [[ ! $vdbench_params[cleanenv]} ]]; then
vdbench_params[cleanenv]="true"
fi
}
print_params()
{
printf "%10s | %1s\n" "vdbench key" "param value"
for param in "${!vdbench_params[@]}"
do
logger info "$param:${vdbench_params[$param]}"
done
}
function logger(){
#echo "[`date '+%d/%m/%y %H:%M:%S:%2N'`]" $@
type=$1
ouput=$2
if [[ $type == "debug" ]]; then
if [[ ${log[debug]} == "true" ]] ; then printf "[%s] [%s ] [%s] %s\n" "`date '+%d/%m/%y %H:%M:%S:%2N'`" "DEBUG" "${FUNCNAME[1]}" "$ouput" | tee -a ${log[debug]}; fi
elif [[ $type == "info" ]] ; then
printf "[%s] [%s ] %s\n" "`date '+%d/%m/%y %H:%M:%S:%2N'`" "INFO" "$ouput" | tee -a ${log[info]}
elif [[ $type == "warn" ]] ; then
printf "[%s] [%s] %s\n" "`date '+%d/%m/%y %H:%M:%S:%2N'`" "WARNING" "$ouput" | tee -a ${log[info]}
elif [[ $type == "error" ]] ; then
printf "[%s] [%s ] [%s] %s\n" "`date '+%d/%m/%y %H:%M:%S:%2N'`" "ERROR" "${FUNCNAME[1]}" "$ouput" | tee -a ${log[error]}
elif [[ $type == "fetal" ]] ; then
printf "[%s] [%s ] [%s] %s\n" "`date '+%d/%m/%y %H:%M:%S:%2N'`" "FETAL" "${FUNCNAME[1]}" "$ouput" | tee -a ${log[error]} ; exit
elif [[ $type == "ver" || $type == "verbose" ]] ; then
if [[ ${log[verbose]} == "true" ]] ; then printf "[%s] [%s] [%s] %s\n" "`date '+%d/%m/%y %H:%M:%S:%2N'`" "VERBOSE" "${FUNCNAME[1]}" "$ouput" | tee -a ${log[verbose]} ;fi
elif [[ ! $type =~ "debug|ver|error|info" ]] ; then
printf "[%s] %s\n" "`date '+%d/%m/%y %H:%M:%S:%2N'`" "$type"
fi
}
function debug(){
[ ${log[debug]} == "true" ] && $@
}
function storageRemoveHosts() {
logger "info" "Removing Existing hosts : "$( ${storageInfo[storageSSH]} lshost -nohdr | awk '{print $2}' | tr "\n" "," | sed -e 's/,$//g')
if [[ ${log[debug]} == "true" ]] ; then
logger "debug" "${storageInfo[storageSSH]} \"i=\"0\"; while [ 1 -lt \`lshost|wc -l\` ]; do echo -e \"host_id \$i \n \"; svctask rmhost -force \$i; i=\$[\$i+1]; done\" "
else
${storageInfo[storageSSH]} "i=\"0\"; while [ 1 -lt \`lshost|wc -l\` ]; do svctask rmhost -force \$i; i=\$[\$i+1]; done"
fi
sleep 2
}
function hostRescan(){
#storageInfo[vdiskPerClient]=$(( storageInfo[volnum] / storageInfo ))
for c in ${vdbench_params[clients]}
do
logger "info" "$c host rescanning "
ssh $c /usr/global/scripts/rescan_all.sh &> ${log[globalLog]}
hostmPathCount=$( ssh $c "multipath -ll|grep -c mpath" )
logger "info" "vdisk per client ${storageInfo[vdiskPerClient]} , vdisks found : [ \" $hostmPathCount \" ]"
hostDeviceCount=$( ssh $c multipath -ll|grep -c mpath )
if [[ ! ${storageInfo[vdiskPerClient]} == $hostDeviceCount ]] ; then
logger "fetal" "!!!!! ERROR | unbalanced devices on host $c | device count [ $hostDeviceCount ] | ERROR !!!!!"
exit
fi
done
}
function removeMdiskGroup(){
mdiskid=`${storageInfo[storageSSH]} ""lsmdiskgrp |grep -v id | sed -r 's/^[^0-9]*([0-9]+).*$/\1/'""`
countMdiskids=`${storageInfo[storageSSH]} "lsmdiskgrp -nohdr | wc -l "`
if [[ $countMdiskids -ge "1" ]]; then
if [[ ${log[debug]} == "true" ]]; then
logger "debug" "Removing mdiskgrp id : $mdiskid from ${storageInfo[stand_name]}"
elif [[ ${log[verbose]} == "true" ]]; then
logger "info" "Removing mdiskgrp id : $mdiskid from ${storageInfo[stand_name]}"
${storageInfo[storageSSH]} svctask rmmdiskgrp -force $mdiskid
else
logger "info" "Removing mdiskgrp id : $mdiskid from ${storageInfo[stand_name]}"
${storageInfo[storageSSH]} svctask rmmdiskgrp -force $mdiskid
fi
else
logger "info" "No mdiskgrp exist on ${storageInfo[stand_name]}"
fi
}
function createHosts() {
clients=${vdbench_params[clients]}
storageInfo[hostCount]=0
logger "info" "Creating hosts ${clients[@]}"
directoryStracture[mountScripts]="scripts"
directoryStracture[pathScripts]="/usr/global/scripts/"
#totalFC=0
for c in ${vdbench_params[clients]}
do
storageInfo[hostCount]=$(( storageInfo[hostCount] + 1 ))
hostWWN $c
storageInfo[mkhost]="svctask mkhost -fcwwpn "
storageInfo[mkhost]=${storageInfo[mkhost]}" ${hostInfo[[$c]['hostWWPN']]} "
storageInfo[mkhost]=${storageInfo[mkhost]}" -force -iogrp io_grp0:io_grp1:io_grp2:io_grp3 "
storageInfo[mkhost]=${storageInfo[mkhost]}"-name $c -type generic"
#storageInfo[mkhost]=${storageInfo[mkhost]}"-name $c -type generic 2>/dev/null "
logger "ver" " [$c] host wwpn ${hostInfo[[$c]['hostWWPN']]}"
logger "debug" " COMMAND \"${storageInfo[storageSSH]} ${storageInfo[mkhost]}\""
${storageInfo[storageSSH]} ${storageInfo[mkhost]} 2>/dev/null
done
logger "info" "Total Host Created ${storageInfo[hostCount]}"
storageInfo[vdiskPerClient]=$(( storageInfo[volnum] / storageInfo[hostCount] ))
logger "verbose" "Total vdisk per client ${storageInfo[vdiskPerClient]}"
}
function hostWWPNCount(){
local host=$1
}
function hostWWN(){
local host=$1
logger "info" "[ $host ] Start collecting host wwpn from "
hostInfo[fc_host_path]="/sys/class/fc_host/"
hostInfo[scsi_host_path]="/sys/class/scsi_host/"
hostInfo[[$host]['fc_hosts']]=$(ssh $host "find ${hostInfo[fc_host_path]} -maxdepth 1 -mindepth 1 -type l -exec basename {} \;" )
hostInfo[[$host]['fc_count']]=0
hostInfo[[$host]['onlineWWNCount']]=0
hostInfo[[$host]['offlineWWNCount']]=0
#printf "fc host %s\n" "$(echo ${hostInfo[[$host]['fc_hosts']]} | tr -d '\n' ) "
for fc_host in $( echo ${hostInfo[[$host]['fc_hosts']]}|tr -d '\n' ); do
#logger "debug" "ssh $host "cat ${hostInfo[fc_host_path]}/$fc_host/port_name ${hostInfo[fc_host_path]}/$fc_host/port_state ${hostInfo[scsi_host_path]}/$fc_host/link_state| tr '\n' ';'\"\n"
hostInfo[[$host][$fc_host]]=`ssh $host "cat ${hostInfo[fc_host_path]}/$fc_host/port_name ${hostInfo[fc_host_path]}/$fc_host/port_state ${hostInfo[scsi_host_path]}/$fc_host/link_state| tr '\n' ';'"`
#echo "host $host fc_host ${hostInfo[[$host][$fc_host]]} fc_count = ${hostInfo[[$host]['fc_count']]}"
if [[ $( echo ${hostInfo[[$host][$fc_host]]} | grep -i up ) ]] ; then
hostInfo[totalOLFCount]=$(( hostInfo[totalOLFCount]+1 ))
hostInfo[[$host]['fc_count']]=$(( hostInfo[[$host]['fc_count']]+1 ))
hostInfo[[$host]['onlineWWNCount']]=$(( hostInfo[[$host]['onlineWWNCount']]+1 ))
if [[ ${hostInfo[[$host]['hostWWPN']]} == "" ]] ; then
hostInfo[[$host]['hostWWPN']]=$(echo ${hostInfo[[$host][$fc_host]]}|awk -F';' '{print $1}' | sed -e 's/^0x//g' )
logger "ver" "WWPN online ${hostInfo[[$host]['hostWWPN']]}"
else
hostInfo[[$host]['hostWWPN']]="${hostInfo[[$host]['hostWWPN']]}:"$(echo ${hostInfo[[$host][$fc_host]]}|awk -F';' '{print $1}' | sed -e 's/^0x//g' )
#printf "WWPN online %s\n" "${hostInfo[[$host]['hostWWPN']]}"
logger "ver" "WWPN online ${hostInfo[[$host]['hostWWPN']]}"
fi
logger "info" "total online fc count ${hostInfo[totalOLFCount]}"
elif [[ $( echo ${hostInfo[[$host][$fc_host]]} | grep -i Down ) ]] ; then
hostInfo[totalOFFCount]=$(( hostInfo[totalOFFCount]+1 ))
hostInfo[[$host]['offlineWWNCount']]=$(( hostInfo[[$host]['offlineWWNCount']]+1 ))
hostInfo[[$host]['fc_count']]=$(( hostInfo[[$host]['fc_count']]+1 ))
if [[ ${hostInfo[[$host]['hostWWPNoffline']]} == "" ]] ; then
hostInfo[[$host]['hostWWPNoffline']]=$(echo ${hostInfo[[$host][$fc_host]]}|awk -F';' '{print $1}' | sed -e 's/^0x//g' )
logger "ver" "WWPN offline %s ${hostInfo[[$host]['hostWWPNoffline']]}"
else
hostInfo[[$host]['hostWWPNoffline']]="${hostInfo[[$host]['hostWWPNoffline']]}:"$(echo ${hostInfo[[$host][$fc_host]]}|awk -F';' '{print $1}' | sed -e 's/^0x//g' )
fi
fi
done
if [[ ${hostInfo[[$host]['hostWWPN']]} != "" ]] ; then logger "info" "WWPN online ${hostInfo[[$host]['hostWWPN']]}" ; fi
if [[ ${hostInfo[[$host]['hostWWPNoffline']]} != "" ]] ; then logger "warn" "WWPN offline ${hostInfo[[$host]['hostWWPNoffline']]}" ; fi
if (( ${hostInfo[[$host]['onlineWWNCount']]} % 2 != "0" )) ; then
logger "error" "$host has only ${hostInfo[[$host]['onlineWWNCount']]} fc ports online "
exit
fi
}
function clearStorageLogs() {
logger "info" "Cleaning Storage logs"
${storageInfo[storageSSH]} svctask clearerrlog -force
}
function initLogger(){
logger "test"
}
function getStorageInfo(){
logger "info" "${storageInfo[stand_name]} Collecting Storage Information"
storageInfo[svcVersion]=$( ${storageInfo[storageSSH]} cat /compass/version )
logger "debug" "svc|version|command|\"${storageInfo[storageSSH]} cat /compass/version\" "
logger "ver" "[svc|version|${storageInfo[svcVersion]}]"
storageInfo[svcBuild]=$( ${storageInfo[storageSSH]} cat /compass/vrmf )
logger "debug" "[svc|build|command|\"${storageInfo[storageSSH]} cat /compass/vrmf\""
logger "ver" "[svc|build|${storageInfo[svcBuild]}]"
storageInfo[hardware]=$( ${storageInfo[storageSSH]} sainfo lshardware | grep hardware | awk '{print $2}' )
logger "debug" "svc hardware|command|\"${storageInfo[storageSSH]} sainfo lshardware | grep hardware | awk '{print \$2}'\""
logger "ver" "[svc|hardware|${storageInfo[hardware]}]"
storageInfo[RaceMQVersion]=$( ${storageInfo[storageSSH]} /data/race/rtc_racemqd -v | grep race | awk '{print $2}')
if [[ $( ${storageInfo[storageSSH]} lscontroller -nohdr | awk '{print $1}') == "" ]]; then
storageInfo[backend]="none"
logger "debug" "svc|backend|output|${storageInfo[backend]}"
logger "debug" "svc|driveCount|command|\"${storageInfo[storageSSH]} lsdrive -nohdr | wc -l\""
storageInfo[driveCount]=$( ${storageInfo[storageSSH]} lsdrive -nohdr | wc -l )
logger "ver" "[svc|driveCount|${storageInfo[driveCount]}]"
else
logger "debug" "svc|backend|command|\"${storageInfo[storageSSH]} sainfo lscontroller -nohdr| awk '{print \$1}'\""
storageInfo[backend]=$( ssh stcon "/opt/FCCon/fcconnect.pl -op showconn -stor ${storageInfo[stand_name]} | grep Storage | awk '{print \$3}'" 2>/dev/null )
logger "ver" "[svc|backend|${storageInfo[backend]}]"
fi
}
function getStorageVolumes(){
logger "debug" "svc|mdiskCount|command|\"${storageInfo[storageSSH]} lsmdisk -nohdr | wc -l\""
storageInfo[mdiskCount]=$( ${storageInfo[storageSSH]} lsmdisk -nohdr | wc -l )
logger "ver" "svc|mdiskCount|output|${storageInfo[mdiskCount]}"
logger "debug" "svc|mdiskSize|command|\"${storageInfo[storageSSH]} lsmdisk -nohdr | awk '{ print $7 }' | uniq | tr '\n' ' '\""
storageInfo[mdiskSize]=$( ${storageInfo[storageSSH]} lsmdisk -nohdr | awk '{ print $7 }' | uniq | tr '\n' ' ' )
logger "ver" "svc|mdiskSize|output|${storageInfo[mdiskSize]}"
}
function vdbenchDirectoryResutls() {
results_path="vdbench_benchmark_test"
log[resultsPath]="${directoryStracture[absPath]}/${storageInfo[svcBuild]}/${storageInfo[svcVersion]}/${log[timestamp]}/$bs"
logger "ver" "results path : [ ${log[resultsPath]} ]"
createDirectory ${log[resultsPath]}
log[test_results]="${log[resultsPath]}/test_results"
logger "ver" "test results path : [ ${log[test_results]} ]"
createDirectory ${log[test_results]}
log[test_files]="${log[resultsPath]}/test_files"
logger "ver" "test files path : [ ${log[test_files]} ]"
createDirectory ${log[test_files]}
log[test_data]="${log[resultsPath]}/output_data"
logger "ver" "test data path : [ ${log[test_data]} ]"
createDirectory ${log[test_data]}
}
function vdbenchMainDirectoryCreation(){
directoryStracture[absPath]="benchmark_results"
logger "ver" "absulte path : [ ${directoryStracture[absPath]} ]"
createDirectory ${directoryStracture[absPath]}
log[logPath]="${directoryStracture[absPath]}/${storageInfo[svcBuild]}/${storageInfo[svcVersion]}/${log[timestamp]}"
logger "ver" "results path : [ ${log[logPath]} ]"
createDirectory ${log[logPath]}
log[globalLog]="${log[logPath]}/${log[logOutput]}"
logger "ver" "globalLog file : [ ${log[globalLog]} ]"
}
function createDirectory() {
directoryPath=$1
if [ ! -d $directoryPath ] ; then
logger "ver" "creating directory [ $directoryPath ]"
mkdir -p $directoryPath
fi
}
function vdbenchResultsFiles() {
log[output_file]=${log[test_results]}/"out_$CP"
logger "ver" "test output file : [ ${log[output_file]} ]"
vdbench[write_test]=${log[test_files]}/$CP"_write"
logger "ver" "vdbench write test file : [ ${vdbench[write_test]} ]"
vdbench[read_test]=${log[test_files]}/$CP"_read"
logger "ver" "vdbench read test file : [ ${vdbench[read_test]} ]"
vdbench[disk_list]=${log[test_files]}/$CP"_disk_list"
logger "ver" "vdbench disk list file : [ ${vdbench[disk_list]} ]"
log[test_info]=${log[resultsPath]}"/vdbench_benchmark_information_$CP.log"
logger "ver" "test info file : [ ${log[test_info]} ]"
}
function createStorageVolumes(){
removeMdiskGroup
storageInfo[mkMasterArray]="${storageInfo[remoteScriptsPath]}/${storageInfo[mkArray]} fc ${storageInfo[raidType]} sas_hdd "
storageInfo[mkVdisk]="${storageInfo[remoteScriptsPath]}/${storageInfo[mkVdisks]} fc 1 ${storageInfo[volnum]} "
logger "info" "Running with storage hardware ${storageInfo[hardware]}"
storageInfo[mkVdiskPattern]="^T5H|SV1|DH8$"
storageInfo[mkArrayPattern]="^[456]00$"
if [[ ${storageInfo[hardware]} =~ ${storageInfo[mkArrayPattern]} ]]; then
logger "info" "storage based drives ${storageInfo[hardware]} "
storageInfo[arrayGroup]=8
storageInfo[driveCount]=$( ${storageInfo[storageSSH]} lsdrive -nohdr | wc -l)
storageInfo[numberMdiskGroup]=$(( ${storageInfo[driveCount]} / ${storageInfo[arrayGroup]} ))
storageInfo[mkMasterArray]+="${storageInfo[driveCount]} ${storageInfo[arrayGroup]} ${storageInfo[numberMdiskGroup]} "
storageInfo[mkMasterArray]+="${storageInfo[volnum]} ${storageInfo[volsize]} ${storageInfo[voltype]} NOFMT NOSCRUB"
storageCopyMK
if [[ ${log[debug]} =~ "true" ]]; then
logger "debug" "${storageInfo[storageSSH]} ${storageInfo[mkMasterArray]}"
elif [[ ${log[verbose]} == "true" ]]; then
logger "ver" "command|${storageInfo[storageSSH]} ${storageInfo[mkMasterArray]}"
${storageInfo[storageSSH]} ${storageInfo[mkMasterArray]} &> ${log[globalLog]}
else
logger "info" "Creating volumes on ${storageInfo[stand_name]}"
logger "info" "mkArray=[${storageInfo[mkMasterArray]}]"
${storageInfo[storageSSH]} ${storageInfo[mkMasterArray]} &> ${log[globalLog]}
fi
elif [[ ${storageInfo[hardware]} =~ ${storageInfo[mkVdiskPattern]} ]] ; then
logger "info" "storage based mdisks ${storageInfo[hardware]} "
storageCopyMK
storageInfo[mkVdisk]=${storageInfo[mkVdisk]}" $(( ${storageInfo[volsize]} * 1000 ))"
storageInfo[mkVdisk]=${storageInfo[mkVdisk]}" 0 NOFMT COMPRESSED AUTOEXP"
# printf "mkVdisk=[%s]" "${storageInfo[mkVdisk]}"
if [[ ${log[debug]} =~ "true" ]]; then
logger "debug" "${storageInfo[storageSSH]} ${storageInfo[mkVdisk]}"
elif [[ ${log[verbose]} == "true" ]]; then
logger "ver" "command| ${storageInfo[storageSSH]} ${storageInfo[mkMasterArray]}"
${storageInfo[storageSSH]} ${storageInfo[mkVdisk]} &> ${log[globalLog]}
else
logger "info" "Creating volumes on ${storageInfo[stand_name]}"
logger "info" "mkVdisk=${storageInfo[mkVdisk]}"
#ssh ${storageInfo[stand_name]} -p 26 ${storageInfo[mkVdisk]} fc 1 ${storageInfo[volnum]} 495600 0 NOFMT COMPRESSED AUTOEXP &> ${log[globalLog]}
${storageInfo[storageSSH]} ${storageInfo[mkVdisk]} &> ${log[globalLog]}
fi
# logger "error" "${storageInfo[mkVdisks]} does not exist on ${storageInfo[stand_name]} path ${storageInfo[remoteScriptsPath]}/${storageInfo[mkVdisks]}"
else
logger "info" "Unknown Hardware Type [ ${storageInfo[hardware]} ]"
exit
fi
sleep 10
}
function storageCopyMK(){
# if ($1 == "hardware") {
# if ($2 ~ /^[48C][AFG][248]$/) type="SVC" ### Matches 4F2 8F2 8F4 8G4 8A4 CF8 CG8
# if ($2 == "DH8") type="BFN" ### mkVdisks
# if ($2 ~ /[13]00/ ) type="V7000" ### mkArray
# if ($2 ~ /[45]00/ ) type="FAB1" ### 400 is 6-core FAB
# if ($2 ~ /T5H/ ) type="TB5" ### mkVdisks
# if ($2 ~ /SV1/ ) type="CAYMAN" ### mkVdisks
# if ($2 ~ /500/ ) type="FAB1" ### mkArray
# if ($2 ~ /600/ ) type="FAB2" ### mkArray
# if ($2 ~ /S01/ ) type="Lenovo"
# /^[T5H][SV1][S01][13][456]00$/ mkVdisk
# /^[13]00[456]00$/ mkArray
#if [[ ${storageInfo[hardware]} =~ /^[48C][AFG][248][SV1]$/ ]]; then
#if [[ ${storageInfo[hardware]} =~ ^[13456]00|[SV1]|[T5H]|[S01]$ ]]; then
if [[ ${storageInfo[hardware]} =~ ${storageInfo[mkVdiskPattern]} ]]; then
logger "info" "Checking if ${storageInfo[mkVdisk]} exist"
if [[ $( ${storageInfo[storageSSH]} "[ -e ${storageInfo[remoteScriptsPath]}/${storageInfo[mkVdisks]} ]") -ne "0" ]]; then
logger "warn" "${storageInfo[mkVdisks]} does not exist on ${storageInfo[stand_name]} path ${storageInfo[remoteScriptsPath]}/${storageInfo[mkVdisks]}"
scp -P 26 ${storageInfo[localScriptPath]}/${storageInfo[mkVdisks]} ${storageInfo[stand_name]}:${storageInfo[remoteScriptsPath]}
logger "ver" "changing permission to ${storageInfo[mkVdisks]}"
${storageInfo[storageSSH]} "chmod a+x ${storageInfo[remoteScriptsPath]}/${storageInfo[mkVdisks]}"
fi
elif [[ ${storageInfo[hardware]} =~ ${storageInfo[mkArrayPattern]} ]];then
if [[ $( ${storageInfo[storageSSH]} "[ -e ${storageInfo[remoteScriptsPath]}/${storageInfo[mkArray]} ]") -ne "0" ]]; then
logger "warn" "copying files to ${storageInfo[stand_name]} ${storageInfo[mkArray]}"
scp -P 26 ${storageInfo[localScriptPath]}/${storageInfo[mkArray]} ${storageInfo[stand_name]}:${storageInfo[remoteScriptsPath]}
logger "ver" "changing permission to ${storageInfo[mkArray]}"
${storageInfo[storageSSH]} "chmod a+x ${storageInfo[remoteScriptsPath]}/${storageInfo[mkArray]}"
fi
else
logger "info" "Error unknow system hardware"
exit
fi
}
function getHostLunSize(){
host=$1
storageInfo[lunSize]=$(ssh $host "multipath -ll| grep size | uniq | awk '{print \$1 }'| cut -f 2 -d '='")
storageInfo[hostLunSize]=`echo ${storageInfo[lunSize]} | sed -e 's/.$//g'`
let "storageInfo[hostLunSize] = ${storageInfo[hostLunSize]} - 1 "
logger "debug" "host name $host Volume Acutal size is ${storageInfo[lunSize]} minus ${storageInfo[hostLunSize]}"
}
function vdbenchDeviceList() {
echo " " > ${vdbench[disk_list]}
for client in ${vdbench_params[clients]}; do
count=1
getHostLunSize $client
for dev in `ssh $client multipath -l|grep "2145" | awk '{print \$1}'`; do
device="/dev/mapper/$dev"
if [[ ${log[debug]} == "true" ]]; then
logger "debug" "vdbench sd output: sd=$client.$count,hd=$client,lun=$device,openflags=o_direct,size=${storageInfo[hostLunSize]}g,threads=${vdbench[threads]}"
count=$(( count+1 ))
elif [[ ${log[verbose]} == "true" ]]; then
logger "ver" "vdbench sd output: sd=$client.$count,hd=$client,lun=$device,openflags=o_direct,size=${storageInfo[hostLunSize]}g,threads=${vdbench[threads]}"
echo "sd=$client.$count,hd=$client,lun=$device,openflags=o_direct,size=${storageInfo[volsize]}g,threads=${vdbench[threads]}" >> ${vdbench[disk_list]}
count=$(( count+1 ))
else
echo "sd=$client.$count,hd=$client,lun=$device,openflags=o_direct,size=${storageInfo[hostLunSize]}g,threads=${vdbench[threads]}" >> ${vdbench[disk_list]}
count=$(( count+1 ))
fi
done
done
}
function vdbenchWriteTest(){
echo "
compratio=$CP
messagescan=no
" > ${vdbench[write_test]}
for client in ${vdbench_params[clients]}; do
if [[ ${log[debug]} == "true" ]]; then
logger "debug" "hd=$client,system=$client.eng.rtca,shell=ssh,vdbench=/root/vdbench,user=root" >> ${vdbench[write_test]}
elif [[ ${log[verbose]} == "true" ]]; then
logger "debug" "hd=$client,system=$client.eng.rtca,shell=ssh,vdbench=/root/vdbench,user=root" >> ${vdbench[write_test]}
echo "hd=$client,system=$client.eng.rtca,shell=ssh,vdbench=/root/vdbench,user=root" >> ${vdbench[write_test]}
else
echo "hd=$client,system=$client.eng.rtca,shell=ssh,vdbench=/root/vdbench,user=root" >> ${vdbench[write_test]}
fi
done
echo "
include=${vdbench[disk_list]}
wd=wd1,sd=*,xfersize=$bs"k",rdpct=0,rhpct=0,seekpct=0
rd=run1,wd=wd1,iorate=max,elapsed=24h,maxdata=${vdbench[write_data]},warmup=360,interval=${vdbench[interval]}
" >> ${vdbench[write_test]}
if [[ ${log[debug]} == 'true' ]]; then
logger "debug" "log output file ${log[output_file]}"
logger "debug" "${vdbench[vdbin]}/vdbench -c -f ${vdbench[write_test]} -o ${log[test_data]}/output_$CP | tee -a ${log[output_file]}"
elif [[ ${log[verbose]} == "true" ]]; then
logger "ver" "${vdbench[vdbin]}/vdbench -c -f ${vdbench[write_test]} -o ${log[test_data]}/output_$CP | tee -a ${log[output_file]}"
`${vdbench[vdbin]}/vdbench -c -f ${vdbench[write_test]} -o ${log[test_data]}/output_$CP | tee -a ${log[output_file]}`
else
`${vdbench[vdbin]}/vdbench -c -f ${vdbench[write_test]} -o ${log[test_data]}/output_$CP >> ${log[output_file]}`
fi
}
function vdbenchReadTest(){
echo "
compratio=$CP
messagescan=no
" > ${vdbench[read_test]}
for client in ${vdbench_params[clients]}; do
if [[ ${log[debug]} == "true" ]];then
logger "debug" " "hd=$client,system=$client.eng.rtca,shell=ssh,vdbench=/root/vdbench,user=root" >> ${vdbench[read_test]}"
elif [[ ${log[verbose]} == "true" ]]; then
logger "ver" " "hd=$client,system=$client.eng.rtca,shell=ssh,vdbench=/root/vdbench,user=root" >> ${vdbench[read_test]}"
echo "hd=$client,system=$client.eng.rtca,shell=ssh,vdbench=/root/vdbench,user=root" >> ${vdbench[read_test]}
else
echo "hd=$client,system=$client.eng.rtca,shell=ssh,vdbench=/root/vdbench,user=root" >> ${vdbench[read_test]}
fi
done
echo "
include=${vdbench[disk_list]}
wd=wd1,sd=*,xfersize=$bs"k",rdpct=100,rhpct=0,seekpct=0
rd=run1,wd=wd1,iorate=max,elapsed=24h,maxdata=${vdbench[read_data]},warmup=360,interval=${vdbench[interval]}
" >> ${vdbench[read_test]}
if [[ ${log[debug]} == 'true' ]];then
logger "debug" "log output file ${log[output_file]}"
logger "debug" "${vdbench[vdbin]}/vdbench -c -f ${vdbench[read_test]} -o ${log[test_data]}/output_$CP | tee -a ${log[output_file]}"
elif [[ ${log[verbose]} == "true" ]]; then
logger "ver" "${vdbench[vdbin]}/vdbench -c -f ${vdbench[read_test]} -o ${log[test_data]}/output_$CP | tee -a ${log[output_file]}"
`${vdbench[vdbin]}/vdbench -c -f ${vdbench[read_test]} -o ${log[test_data]}/output_$CP | tee -a ${log[output_file]}`
else
`${vdbench[vdbin]}/vdbench -c -f ${vdbench[read_test]} -o ${log[test_data]}/output_$CP >> ${log[output_file]}`
fi
}
function clear_storage_logs(){
logger "ver" "Clearing Storage event logs"
${storageInfo[storageSSH]} "svctask clearerrlog -force"
}
function displayVdbenchResults() {
testResultsData[write]=`cat ${log[output_file]} | grep -i avg | head -1 | tr -s ' ' ',' | sed -e 's/$/\n/'`
testResultsData[read]=`cat ${log[output_file]} | grep -i avg | tail -1 | tr -s ' ' ',' | sed -e 's/$/\n/'`
logger "info" "vdbench result \t write results [ $(echo ${testResultsData[write]} | awk '{print $3}' ) ] read results $(echo ${testResultsData[read]} | awk '{print $4 }' ) } "
}
function createStorageJsonFile() {
echo "
{
\"ResultsType\": \"DEV\",
\"testType\": \"IOZONE\",
\"stand\": \"${storageInfo[stand_name]}\",
\"SVC_Version\": \"${storageInfo[svcVersion]}\",
\"SVCBuilds\": \"${storageInfo[svcBuild]}\",
\"backend\": \"${storageInfo[backend]}\",
\"diskType\": \"NONE\",
\"noOfDisks\": \"8\",
\"totalDisks\": \"1.2\",
\"Raid\": \"\",
\"testmode\": \"CMP\",
\"vdiskCount\": \"${storageInfo[volnum]}\",
\"vdiskSize\": \"${storageInfo[volsize]}\",
\"coleto\": \"\",
\"coleto_level\": \"2\",
\"ClientMgmt\": \"`hostname`\",
\"Clients\": \"${clients[@]}\",
\"ClientsNum\": \"${storageInfo[hostCount]}\",
\"ThreadsPerClient\": \"${storageInfo[threads]}\",
\"LunPerClient\": \"$(( ${storageInfo[volnum]} / ${storageInfo[hostCount]} ))\",
\"FCperClient\": \"$(( ${hostInfo[totalOLFCount]} / ${storageInfo[hostCount]} ))\",
\"RaceMQVersion\": \"${storageInfo[RaceMQVersion]}\",
\"MultiRace\": \"$( ${storageInfo[storageSSH]} ps -efL | grep race | awk '$10 ~/racemqAd/ { racemqAd++ } $10 ~ /racemqBd/ { racemqBd++ } $10 ~ /rtc_racemqd/ { rtc_racemqd++ }END { if ( racemqAd < 2 || racemqBd < 2 && rtc_racemqd == 0 ) {print "1"} else { print "2" } }' )\",
" > ${log[logPath]}/${storageInfo[jsonFile]}
logger "info" "storageJsonFile|${log[logPath]}/${storageInfo[jsonFile]}"
}
function createJsonResults(){
local compRatio=$1
}
#function _info(){ echo }
#function _error(){ echo }
#function _verbose(){ echo }
#function _debug(){ echo }
###
# function jsonFile
# function storageInfo
# function storageInfo
# function createTestFile
# function storageInfo
parse_parameter "$@"
checking_params
if [[ ${log[debug]} == "true" ]] ; then print_params ; fi
storageInfo[storageSSH]="ssh -p 26 ${storageInfo[stand_name]} "
getStorageInfo
vdbenchMainDirectoryCreation
if [[ ${vdbench[cshost]} == "true" ]] ; then
storageRemoveHosts
createHosts
fi
createStorageJsonFile
for bs in ${vdbench[blocksize]}; do
log[testCount]=1
for CP in ${vdbench[cmprun]} ; do
clearStorageLogs
if [[ ${vdbench[csdev]} == "true" ]] ; then createStorageVolumes ; fi
logger "info" "===[ ${log[testCount]} ]===[ blocksize | $bs ]====[ RATIO | $CP ]=============================================="
getStorageVolumes
vdbenchDirectoryResutls
if [[ ${vdbench[hrdev]} == "true" ]] ; then hostRescan ; fi
#vdbenchResultsFiles
#vdbenchDeviceList
#vdbenchWriteTest
#vdbenchReadTest
displayVdbenchResults
log[testCount]=$(( log[testCount] + 1 ))
done
vdbench[hsrm]="true"
vdbench[hrdev]="true"
vdbench[cshost]="true"
vdbench[csdev]="true"
done
# log output example
# [21/10/16 19:10:22] [INFO]
# [21/10/16 19:10:22] [ERROR]
# [21/10/16 19:10:22] [VERBOSE]
# [21/10/16 19:10:22] [DEBUG]
#### resultsstracture
# vdbenchResutls[[CMP_RATIO][start]]
# vdbenchResutls[[CMP_RATIO][end]]
# vdbenchResutls[[CMP_RATIO][write]]
# vdbenchResutls[[CMP_RATIO][read]]