Shital Savekar 2018-05-23 14:43:45 -07:00
Родитель 3f8e1997e7 3b278fe66b
Коммит db61d4a3ae
5 изменённых файлов: 614 добавлений и 2 удалений

Просмотреть файл

@ -8147,6 +8147,21 @@
</TestParameters>
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-N-Series-GPU-TEST-NC24rsv2</testName>
<testScript>
</testScript>
<testScriptps1>ICA-N-Series-GPU-TEST.ps1</testScriptps1>
<setupType>SingleVM</setupType>
<OverrideVMSize>Standard_NC24rs_v2</OverrideVMSize>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<SubtestValues>SOME,TEXTS,NEEDS,TO,BE,PRESENT,HERE,FOR,PRINTING,TEST,SUMMARY</SubtestValues>
<files>.\remote-scripts\azuremodules.sh</files>
<TestParameters>
<param>enableProposedRepo=yes</param>
</TestParameters>
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-BUILD-CUSTOM-VM-CAPTURE-VHD-ARM-NEXT</testName>
<testScript>
@ -9516,6 +9531,9 @@
<test>
<Name>ICA-N-Series-GPU-TEST-NC24r</Name>
</test>
<test>
<Name>ICA-N-Series-GPU-TEST-NC24rsv2</Name>
</test>
</Cycle>
<Cycle>
<cycleName>CAPTURE-VHD-NEXT</cycleName>

Просмотреть файл

@ -77,7 +77,7 @@ try
{
Write-Host "Getting $destinationStorageAccount storage account key..."
$allResources = Get-AzureRmResource
$destSARG = ($allResources | Where { $_.ResourceType -imatch "storageAccounts" -and $_.ResourceName -eq "$destinationStorageAccount" }).ResourceGroupName
$destSARG = ($allResources | Where { $_.ResourceType -imatch "storageAccounts" -and $_.Name -eq "$destinationStorageAccount" }).ResourceGroupName
$keyObj = Get-AzureRmStorageAccountKey -ResourceGroupName $destSARG -Name $destinationStorageAccount
$destinationStorageKey = $keyObj[0].Value
}

Просмотреть файл

@ -0,0 +1,248 @@
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$testVMData = $allVMData
ProvisionVMsForLisa -allVMData $allVMData -installPackagesOnRoleNames "none"
LogMsg "Generating constansts.sh ..."<#
$constantsFile = "$LogDir\constants.sh"
Set-Content -Value "#Generated by Azure Automation." -Path $constantsFile
foreach ( $param in $currentTestData.TestParameters.param)
{
Add-Content -Value "$param" -Path $constantsFile
LogMsg "$param added to constants.sh"
if ( $param -imatch "startThread" )
{
$startThread = [int]($param.Replace("startThread=",""))
}
if ( $param -imatch "maxThread" )
{
$maxThread = [int]($param.Replace("maxThread=",""))
}
}
LogMsg "constanst.sh created successfully..."
#endregion
#region EXECUTE TEST
$myString = @"
chmod +x perf_fio.sh
./perf_fio.sh &> fioConsoleLogs.txt
. azuremodules.sh
collect_VM_properties
"@
$myString2 = @"
wget https://konkaciwestus1.blob.core.windows.net/scriptfiles/JSON.awk
wget https://konkaciwestus1.blob.core.windows.net/scriptfiles/gawk
wget https://konkaciwestus1.blob.core.windows.net/scriptfiles/fio_jason_parser.sh
chmod +x *.sh
cp fio_jason_parser.sh gawk JSON.awk /root/FIOLog/jsonLog/
cd /root/FIOLog/jsonLog/
./fio_jason_parser.sh
cp perf_fio.csv /root
chmod 666 /root/perf_fio.csv
"@
Set-Content "$LogDir\StartFioTest.sh" $myString
Set-Content "$LogDir\ParseFioTestLogs.sh" $myString2
RemoteCopy -uploadTo $testVMData.PublicIP -port $testVMData.SSHPort -files ".\$constantsFile,.\Testscripts\Linux\azuremodules.sh,.\Testscripts\Linux\perf_fio.sh,.\$LogDir\StartFioTest.sh,.\$LogDir\ParseFioTestLogs.sh" -username "root" -password $password -upload
RemoteCopy -uploadTo $testVMData.PublicIP -port $testVMData.SSHPort -files $currentTestData.files -username "root" -password $password -upload
$out = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh" -runAsSudo
$testJob = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "./StartFioTest.sh" -RunInBackground -runAsSudo
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "tail -1 runlog.txt"-runAsSudo
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 20
}
$finalStatus = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "cat state.txt"
RemoteCopy -downloadFrom $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "FIOTest-*.tar.gz"
RemoteCopy -downloadFrom $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "VM_properties.csv"
$testSummary = $null
#endregion
#>
$finalStatus = "TestCompleted"
if ( $finalStatus -imatch "TestFailed")
{
LogErr "Test failed. Last known status : $currentStatus."
$testResult = "FAIL"
}
elseif ( $finalStatus -imatch "TestAborted")
{
LogErr "Test Aborted. Last known status : $currentStatus."
$testResult = "ABORTED"
}
elseif ( $finalStatus -imatch "TestCompleted")
{
$out = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "/root/ParseFioTestLogs.sh"
RemoteCopy -downloadFrom $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "perf_fio.csv"
LogMsg "Test Completed."
$testResult = "PASS"
}
elseif ( $finalStatus -imatch "TestRunning")
{
LogMsg "Powershell backgroud job for test is completed but VM is reporting that test is still running. Please check $LogDir\zkConsoleLogs.txt"
LogMsg "Contests of summary.log : $testSummary"
$testResult = "PASS"
}
LogMsg "Test result : $testResult"
LogMsg "Test Completed"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
try
{
foreach($line in (Get-Content "$LogDir\perf_fio.csv"))
{
if ( $line -imatch "Max IOPS of each mode" )
{
$maxIOPSforMode = $true
$maxIOPSforBlockSize = $false
$fioData = $false
}
if ( $line -imatch "Max IOPS of each BlockSize" )
{
$maxIOPSforMode = $false
$maxIOPSforBlockSize = $true
$fioData = $false
}
if ( $line -imatch "Iteration,TestType,BlockSize" )
{
$maxIOPSforMode = $false
$maxIOPSforBlockSize = $false
$fioData = $true
}
if ( $maxIOPSforMode )
{
Add-Content -Value $line -Path $LogDir\maxIOPSforMode.csv
}
if ( $maxIOPSforBlockSize )
{
Add-Content -Value $line -Path $LogDir\maxIOPSforBlockSize.csv
}
if ( $fioData )
{
Add-Content -Value $line -Path $LogDir\fioData.csv
}
}
$maxIOPSforModeCsv = Import-Csv -Path $LogDir\maxIOPSforMode.csv
$maxIOPSforBlockSizeCsv = Import-Csv -Path $LogDir\maxIOPSforBlockSize.csv
$fioDataCsv = Import-Csv -Path $LogDir\fioData.csv
LogMsg "Uploading the test results.."
$dataSource = $xmlConfig.config.Azure.database.server
$DBuser = $xmlConfig.config.Azure.database.user
$DBpassword = $xmlConfig.config.Azure.database.password
$database = $xmlConfig.config.Azure.database.dbname
$dataTableName = $xmlConfig.config.Azure.database.dbtable
$TestCaseName = $xmlConfig.config.Azure.database.testTag
if ($dataSource -And $DBuser -And $DBpassword -And $database -And $dataTableName)
{
$GuestDistro = cat "$LogDir\VM_properties.csv" | Select-String "OS type"| %{$_ -replace ",OS type,",""}
if ( $UseAzureResourceManager )
{
$HostType = "Azure-ARM"
}
else
{
$HostType = "Azure"
}
$HostBy = ($xmlConfig.config.Azure.General.Location).Replace('"','')
$HostOS = cat "$LogDir\VM_properties.csv" | Select-String "Host Version"| %{$_ -replace ",Host Version,",""}
$GuestOSType = "Linux"
$GuestDistro = cat "$LogDir\VM_properties.csv" | Select-String "OS type"| %{$_ -replace ",OS type,",""}
$GuestSize = $testVMData.InstanceSize
$KernelVersion = cat "$LogDir\VM_properties.csv" | Select-String "Kernel version"| %{$_ -replace ",Kernel version,",""}
$connectionString = "Server=$dataSource;uid=$DBuser; pwd=$DBpassword;Database=$database;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"
$SQLQuery = "INSERT INTO $dataTableName (TestCaseName,TestDate,HostType,HostBy,HostOS,GuestOSType,GuestDistro,GuestSize,KernelVersion,DiskSetup,BlockSize_KB,QDepth,seq_read_iops,seq_read_lat_usec,rand_read_iops,rand_read_lat_usec,seq_write_iops,seq_write_lat_usec,rand_write_iops,rand_write_lat_usec) VALUES "
for ( $QDepth = $startThread; $QDepth -le $maxThread; $QDepth *= 2 )
{
$seq_read_iops = ($fioDataCsv | where { $_.TestType -eq "read" -and $_.Threads -eq "$QDepth"} | Select ReadIOPS).ReadIOPS
$seq_read_lat_usec = ($fioDataCsv | where { $_.TestType -eq "read" -and $_.Threads -eq "$QDepth"} | Select MaxOfReadMeanLatency).MaxOfReadMeanLatency
$rand_read_iops = ($fioDataCsv | where { $_.TestType -eq "randread" -and $_.Threads -eq "$QDepth"} | Select ReadIOPS).ReadIOPS
$rand_read_lat_usec = ($fioDataCsv | where { $_.TestType -eq "randread" -and $_.Threads -eq "$QDepth"} | Select MaxOfReadMeanLatency).MaxOfReadMeanLatency
$seq_write_iops = ($fioDataCsv | where { $_.TestType -eq "write" -and $_.Threads -eq "$QDepth"} | Select WriteIOPS).WriteIOPS
$seq_write_lat_usec = ($fioDataCsv | where { $_.TestType -eq "write" -and $_.Threads -eq "$QDepth"} | Select MaxOfWriteMeanLatency).MaxOfWriteMeanLatency
$rand_write_iops = ($fioDataCsv | where { $_.TestType -eq "randwrite" -and $_.Threads -eq "$QDepth"} | Select WriteIOPS).WriteIOPS
$rand_write_lat_usec= ($fioDataCsv | where { $_.TestType -eq "randwrite" -and $_.Threads -eq "$QDepth"} | Select MaxOfWriteMeanLatency).MaxOfWriteMeanLatency
$BlockSize_KB= (($fioDataCsv | where { $_.Threads -eq "$QDepth"} | Select BlockSize)[0].BlockSize).Replace("K","")
$SQLQuery += "('$TestCaseName','$(Get-Date -Format yyyy-MM-dd)','$HostType','$HostBy','$HostOS','$GuestOSType','$GuestDistro','$GuestSize','$KernelVersion','RAID0:12xP30','$BlockSize_KB','$QDepth','$seq_read_iops','$seq_read_lat_usec','$rand_read_iops','$rand_read_lat_usec','$seq_write_iops','$seq_write_lat_usec','$rand_write_iops','$rand_write_lat_usec'),"
LogMsg "Collected performace data for $QDepth QDepth."
}
$SQLQuery = $SQLQuery.TrimEnd(',')
Write-Host $SQLQuery
$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = $connectionString
$connection.Open()
$command = $connection.CreateCommand()
$command.CommandText = $SQLQuery
$result = $command.executenonquery()
$connection.Close()
LogMsg "Uploading the test results done!!"
}
else
{
LogMsg "Invalid database details. Failed to upload result to database!"
}
}
catch
{
$ErrorMessage = $_.Exception.Message
LogErr "EXCEPTION : $ErrorMessage"
}
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = "NTTTCP RESULT"
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
}
}
else
{
$testResult = "Aborted"
$resultArr += $testResult
}
$result = GetFinalResultHeader -resultarr $resultArr
#Clean up the setup
DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
#Return the result and summery to the test suite script..
return $result, $resultSummary

Просмотреть файл

@ -93,7 +93,7 @@ InstallFIO() {
elif [[ $DISTRO =~ "SUSE Linux Enterprise Server 12" ]];
then
LogMsg "Detected SLES12. Installing required packages"
zypper addrepo http://download.opensuse.org/repositories/benchmark/SLE_12_SP2_Backports/benchmark.repo
zypper addrepo http://download.opensuse.org/repositories/benchmark/SLE_12_SP3_Backports/benchmark.repo
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys refresh
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys remove gettext-runtime-mini-0.19.2-1.103.x86_64
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys install sysstat

Просмотреть файл

@ -0,0 +1,346 @@
#!/bin/bash
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# Sample script to run sysbench.
# In this script, we want to bench-mark device IO performance on a mounted folder.
# You can adapt this script to other situations easily like for stripe disks as RAID0.
# The only thing to keep in mind is that each different configuration you're testing
# must log its output to a different directory.
#
HOMEDIR="/root"
LogMsg()
{
echo "[$(date +"%x %r %Z")] ${1}"
echo "[$(date +"%x %r %Z")] ${1}" >> "${HOMEDIR}/runlog.txt"
}
LogMsg "Sleeping 10 seconds.."
sleep 10
#export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/share/oem/bin:/usr/share/oem/python/bin:/opt/bin
CONSTANTS_FILE="$HOMEDIR/constants.sh"
ICA_TESTRUNNING="TestRunning" # The test is running
ICA_TESTCOMPLETED="TestCompleted" # The test completed successfully
ICA_TESTABORTED="TestAborted" # Error during the setup of the test
ICA_TESTFAILED="TestFailed" # Error occurred during the test
touch ./fioTest.log
if [ -e ${CONSTANTS_FILE} ]; then
. ${CONSTANTS_FILE}
else
errMsg="Error: missing ${CONSTANTS_FILE} file"
LogMsg "${errMsg}"
UpdateTestState $ICA_TESTABORTED
exit 10
fi
UpdateTestState()
{
echo "${1}" > $HOMEDIR/state.txt
}
InstallFIO() {
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux\|clear-linux-os" /etc/{issue,*release,*version} /usr/lib/os-release`
if [[ $DISTRO =~ "Ubuntu" ]] || [[ $DISTRO =~ "Debian" ]];
then
LogMsg "Detected UBUNTU/Debian. Installing required packages"
until dpkg --force-all --configure -a; sleep 10; do echo 'Trying again...'; done
apt-get update
apt-get install -y pciutils gawk mdadm
apt-get install -y wget sysstat blktrace bc fio
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install fio"
exit 1
fi
mount -t debugfs none /sys/kernel/debug
elif [[ $DISTRO =~ "Red Hat Enterprise Linux Server release 6" ]];
then
LogMsg "Detected RHEL 6.x; Installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum -y --nogpgcheck install wget sysstat mdadm blktrace libaio fio
mount -t debugfs none /sys/kernel/debug
elif [[ $DISTRO =~ "Red Hat Enterprise Linux Server release 7" ]];
then
LogMsg "Detected RHEL 7.x; Installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y --nogpgcheck install wget sysstat mdadm blktrace libaio fio
mount -t debugfs none /sys/kernel/debug
elif [[ $DISTRO =~ "CentOS Linux release 6" ]] || [[ $DISTRO =~ "CentOS release 6" ]];
then
LogMsg "Detected CentOS 6.x; Installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum -y --nogpgcheck install wget sysstat mdadm blktrace libaio fio
mount -t debugfs none /sys/kernel/debug
elif [[ $DISTRO =~ "CentOS Linux release 7" ]];
then
LogMsg "Detected CentOS 7.x; Installing required packages"
rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y --nogpgcheck install wget sysstat mdadm blktrace libaio fio
mount -t debugfs none /sys/kernel/debug
elif [[ $DISTRO =~ "SUSE Linux Enterprise Server 12" ]];
then
LogMsg "Detected SLES12. Installing required packages"
zypper addrepo http://download.opensuse.org/repositories/benchmark/SLE_12_SP3_Backports/benchmark.repo
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys refresh
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys remove gettext-runtime-mini-0.19.2-1.103.x86_64
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys install sysstat
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys install grub2
zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys install wget mdadm blktrace libaio1 fio
elif [[ $DISTRO =~ "clear-linux-os" ]];
then
LogMsg "Detected Clear Linux OS. Installing required packages"
swupd bundle-add dev-utils-dev sysadmin-basic performance-tools os-testsuite-phoronix network-basic openssh-server dev-utils os-core os-core-dev
else
LogMsg "Unknown Distro"
UpdateTestState "TestAborted"
UpdateSummary "Unknown Distro, test aborted"
return 1
fi
}
RunFIO()
{
UpdateTestState ICA_TESTRUNNING
FILEIO="--size=${fileSize} --direct=1 --ioengine=libaio --filename=fiodata --overwrite=1 "
####################################
#All run config set here
#
#Log Config
mkdir $HOMEDIR/FIOLog/jsonLog
mkdir $HOMEDIR/FIOLog/iostatLog
mkdir $HOMEDIR/FIOLog/blktraceLog
#LOGDIR="${HOMEDIR}/FIOLog"
JSONFILELOG="${LOGDIR}/jsonLog"
IOSTATLOGDIR="${LOGDIR}/iostatLog"
BLKTRACELOGDIR="${LOGDIR}/blktraceLog"
LOGFILE="${LOGDIR}/fio-test.log.txt"
#redirect blktrace files directory
Resource_mount=$(mount -l | grep /sdb1 | awk '{print$3}')
blk_base="${Resource_mount}/blk-$(date +"%m%d%Y-%H%M%S")"
mkdir $blk_base
#
#
#Test config
#
#
#All possible values for file-test-mode are randread randwrite read write
#modes='randread randwrite read write'
iteration=0
#startThread=1
#startIO=8
#numjobs=1
#Max run config
#ioruntime=300
#maxThread=1024
#maxIO=8
io_increment=128
####################################
echo "Test log created at: ${LOGFILE}"
echo "===================================== Starting Run $(date +"%x %r %Z") ================================"
echo "===================================== Starting Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE
chmod 666 $LOGFILE
echo "Preparing Files: $FILEIO"
echo "Preparing Files: $FILEIO" >> $LOGFILE
LogMsg "Preparing Files: $FILEIO"
# Remove any old files from prior runs (to be safe), then prepare a set of new files.
rm fiodata
echo "--- Kernel Version Information ---" >> $LOGFILE
uname -a >> $LOGFILE
cat /proc/version >> $LOGFILE
cat /etc/*-release >> $LOGFILE
echo "--- PCI Bus Information ---" >> $LOGFILE
lspci >> $LOGFILE
echo "--- Drive Mounting Information ---" >> $LOGFILE
mount >> $LOGFILE
echo "--- Disk Usage Before Generating New Files ---" >> $LOGFILE
df -h >> $LOGFILE
fio --cpuclock-test >> $LOGFILE
fio $FILEIO --readwrite=read --bs=1M --runtime=1 --iodepth=128 --numjobs=8 --name=prepare
echo "--- Disk Usage After Generating New Files ---" >> $LOGFILE
df -h >> $LOGFILE
echo "=== End Preparation $(date +"%x %r %Z") ===" >> $LOGFILE
LogMsg "Preparing Files: $FILEIO: Finished."
####################################
#Trigger run from here
for testmode in $modes; do
io=$startIO
while [ $io -le $maxIO ]
do
Thread=$startThread
while [ $Thread -le $maxThread ]
do
if [ $Thread -ge 8 ]
then
numjobs=8
else
numjobs=$Thread
fi
iostatfilename="${IOSTATLOGDIR}/iostat-fio-${testmode}-${io}K-${Thread}td.txt"
nohup iostat -x 5 -t -y > $iostatfilename &
#capture blktrace output during test
#LogMsg "INFO: start blktrace for 40 sec on device sdd and sdf"
#blk_operation="${blk_base}/blktrace-fio-${testmode}-${io}K-${Thread}td/"
#mkdir $blk_operation
#blktrace -w 40 -d /dev/sdf -D $blk_operation &
#blktrace -w 40 -d /dev/sdm -D $blk_operation &
echo "-- iteration ${iteration} ----------------------------- ${testmode} test, ${io}K bs, ${Thread} threads, ${numjobs} jobs, 5 minutes ------------------ $(date +"%x %r %Z") ---" >> $LOGFILE
LogMsg "Running ${testmode} test, ${io}K bs, ${Thread} threads ..."
jsonfilename="${JSONFILELOG}/fio-result-${testmode}-${io}K-${Thread}td.json"
fio $FILEIO --readwrite=$testmode --bs=${io}K --runtime=$ioruntime --iodepth=$Thread --numjobs=$numjobs --output-format=json --output=$jsonfilename --name="iteration"${iteration} >> $LOGFILE
#fio $FILEIO --readwrite=$testmode --bs=${io}K --runtime=$ioruntime --iodepth=$Thread --numjobs=$numjobs --name="iteration"${iteration} --group_reporting >> $LOGFILE
iostatPID=`ps -ef | awk '/iostat/ && !/awk/ { print $2 }'`
kill -9 $iostatPID
Thread=$(( Thread*2 ))
iteration=$(( iteration+1 ))
done
io=$(( io * io_increment ))
done
done
####################################
echo "===================================== Completed Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE
rm fiodata
compressedFileName="${HOMEDIR}/FIOTest-$(date +"%m%d%Y-%H%M%S").tar.gz"
LogMsg "INFO: Please wait...Compressing all results to ${compressedFileName}..."
tar -cvzf $compressedFileName $LOGDIR/
echo "Test logs are located at ${LOGDIR}"
UpdateTestState ICA_TESTCOMPLETED
}
CreateRAID0()
{
disks=$(ls -l /dev | grep sd[c-z]$ | awk '{print $10}')
#disks=(`fdisk -l | grep 'Disk.*/dev/sd[a-z]' |awk '{print $2}' | sed s/://| sort| grep -v "/dev/sd[ab]$" `)
LogMsg "INFO: Check and remove RAID first"
mdvol=$(cat /proc/mdstat | grep "active raid" | awk {'print $1'})
if [ -n "$mdvol" ]; then
echo "/dev/${mdvol} already exist...removing first"
umount /dev/${mdvol}
mdadm --stop /dev/${mdvol}
mdadm --remove /dev/${mdvol}
mdadm --zero-superblock /dev/sd[c-z][1-5]
fi
LogMsg "INFO: Creating Partitions"
count=0
for disk in ${disks}
do
echo "formatting disk /dev/${disk}"
(echo d; echo n; echo p; echo 1; echo; echo; echo t; echo fd; echo w;) | fdisk /dev/${disk}
count=$(( $count + 1 ))
sleep 1
done
LogMsg "INFO: Creating RAID of ${count} devices."
sleep 1
mdadm --create ${mdVolume} --level 0 --raid-devices ${count} /dev/sd[c-z][1-5]
sleep 1
time mkfs -t $1 -F ${mdVolume}
mkdir ${mountDir}
sleep 1
mount -o nobarrier ${mdVolume} ${mountDir}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to create raid"
exit 1
else
LogMsg "${mdVolume} mounted to ${mountDir} successfully."
fi
#LogMsg "INFO: adding fstab entry"
#echo "${mdVolume} ${mountDir} ext4 defaults 1 1" >> /etc/fstab
}
CreateLVM()
{
disks=$(ls -l /dev | grep sd[c-z]$ | awk '{print $10}')
#disks=(`fdisk -l | grep 'Disk.*/dev/sd[a-z]' |awk '{print $2}' | sed s/://| sort| grep -v "/dev/sd[ab]$" `)
#LogMsg "INFO: Check and remove LVM first"
vgExist=$(vgdisplay)
if [ -n "$vgExist" ]; then
umount ${mountDir}
lvremove -A n -f /dev/${vggroup}/lv1
vgremove ${vggroup} -f
fi
LogMsg "INFO: Creating Partition"
count=0
for disk in ${disks}
do
echo "formatting disk /dev/${disk}"
(echo d; echo n; echo p; echo 1; echo; echo; echo t; echo fd; echo w;) | fdisk /dev/${disk}
count=$(( $count + 1 ))
done
LogMsg "INFO: Creating LVM with all data disks"
pvcreate /dev/sd[c-z][1-5]
vgcreate ${vggroup} /dev/sd[c-z][1-5]
lvcreate -l 100%FREE -i 12 -I 64 ${vggroup} -n lv1
time mkfs -t $1 -F /dev/${vggroup}/lv1
mkdir ${mountDir}
mount -o nobarrier /dev/${vggroup}/lv1 ${mountDir}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to create LVM "
exit 1
fi
#LogMsg "INFO: adding fstab entry"
#echo "${mdVolume} ${mountDir} ext4 defaults 1 1" >> /etc/fstab
}
############################################################
# Main body
############################################################
HOMEDIR=$HOME
mv $HOMEDIR/FIOLog/ $HOMEDIR/FIOLog-$(date +"%m%d%Y-%H%M%S")/
mkdir $HOMEDIR/FIOLog
LOGDIR="${HOMEDIR}/FIOLog"
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version}`
if [[ $DISTRO =~ "SUSE Linux Enterprise Server 12" ]];
then
mdVolume="/dev/md/mdauto0"
else
mdVolume="/dev/md0"
fi
vggroup="vg1"
mountDir="/data"
cd ${HOMEDIR}
InstallFIO
#Creating RAID before triggering test
CreateRAID0 ext4
#CreateLVM ext4
#Run test from here
LogMsg "*********INFO: Starting test execution*********"
cd ${mountDir}
mkdir sampleDIR
RunFIO
LogMsg "*********INFO: Script execution reach END. Completed !!!*********"