-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSet-VdbenchSD.ps1
38 lines (33 loc) · 1.51 KB
/
Set-VdbenchSD.ps1
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
###########################################################################
$basedir = Split-Path -parent $MyInvocation.MyCommand.Definition
$workload_profiles = $(Get-Childitem $basedir\workloads\curves\*.cfg)
$outputdir = $basedir + "\output"
$vdbench = $basedir + "\vdbench50403\vdbench.bat"
$timestamp=Get-Date -Format 'yyyyMMdd-HHmmss' #20161008-101629
#$rundir = ($outputdir + "\" + $run + "\")
#md $rundir -ErrorAction SilentlyContinue
###########################################################################
$regex = "^(?=.*?\b'sd'\b)(?!'*'.)*$."
Function Get-VdbenchSD () {
#TODO: Use Get-PSDrive provider property and select non-os drive to avoid wiping out OS
$DiskDrives = Get-WmiObject WIn32_DiskDrive | Select Index, DeviceID, Size | Sort Index
$SD = $(foreach ($Disk in $DiskDrives) {"sd=Disk$($Disk.Index),lun=$($Disk.DeviceID),openflags=directio,size=$([Math]::Floor($Disk.Size / 1GB))g"})
return $SD[1]
}
Function Set-VdbenchSD ($PathToFile, $StringToFind, $StringToReplace) {
(Get-Content $PathToFile) |
Foreach-Object {$_ -replace $StringToFind, $StringToReplace } |
Set-Content $PathToFile
}
$SD = Get-VdbenchSD
Write-Verbose ""
Write-Verbose "Setting Vdbench Workload Storage Device parameter"
ForEach ($w in $workload_profiles){
$regex = "^sd.*?$"
write-verbose "$w.name"
Set-VdbenchSD $w $regex $sd
gc $w | sls ",size=" | Write-Verbose
Write-Verbose "----------------------"
}
# Run the following command to validate the change was made
#Get-Content .\workloads\curves\*.cfg | sls ",size="