/
SolidFire-VMware-Best-Practices.ps1
312 lines (246 loc) · 10.7 KB
/
SolidFire-VMware-Best-Practices.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
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
<#
SolidFire VMware Best Practices Implementation Script
This script simplifies implementation of recommended
configurations for VMware environments
Authors: Josh Atwell | josh.atwell@soldifire.com
Aaron Patten | aaron.patten@solidfire.com
====================================================================
| Disclaimer: |
| This script is written as best effort and provides no warranty |
| expressed or implied. Please contact SolidFire support if you |
| have questions about this script before running or modifying. |
====================================================================
Requirements:
1. Active PowerCLI connection to a vCenter server or ESXi host
2. User must have privileges to make changes to advanced settings
3. Evaluation of each segment's configuration changes as it relates
to your environment. Not all recommendations apply to everyone
PLEASE READ ALL SCRIPT BLOCKS!
#>
###### User Input Section ########
<# User Checklist. Choose:
1. Verbose and Confirm selection
2. VMhosts to apply
3. Options to apply
#>
###### 1. Verbose Output ######
# Verbose writes output letting user know what is happening throughout the script.
$verbose = $true
###### 1b. Confirm ######
# Instructs the script whether to confirm your command or not.
# False means user will receive no confiromation.
$Confirm = $false
###### 2. VMware Host Selection ######
<# Choose the vSphere host filter.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Requires active connection to your vCenter server !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#>
If ((Get-PSSnapin "VMware.VimAutomation.Core" -ErrorAction SilentlyContinue) -eq $null) {
Write-Output "This script must be run in PowerShell session with PowerCLI loaded"
Return
}else{
$vmhosts = Get-VMhost
}
###### 3. Options to Apply ######
<# Beneath this section choose the components that you want to include.
Options included in script.
1 | Increase MaxHWTransferSize size from 4MB to 16MB !!! only for Nitrogen
2 | Set DSNRO (Disk Scheduler Number Req Outstanding for a volume
3 | Set Queue Depth for Software iSCSI initiator to 256
4 | Turn Off DelayedAck for Random Workloads !!! Only for throughput heavy workloads or latency senstive applications
5 | Create Custom SATP Rule for SolidFire
Use if you need to include only specific settings.
Must be comma-separated or all
Examples
$apply = 2,3,5
$apply = "all"
#>
$apply = 4
####### The Script blocks #######
if($verbose = $true){
Write-Output "
______________ ___
/__/__\__\__\__\ ___/__/
/_ /__/_\__\__\__\ ___/__/__/
/__/__/__/\__\__\__\/__/__/__/
/__/__/__/ \__\__\__\_/__/__/
/__/__/ \__\__\__\__/__/
/__/ \__\__\__\/__/
Fueled By SolidFire
SolidFire VMware Configuration
Implementation Script
"
}
######### Begin Block 1 | MaxHWTransferSize ####################
if($apply -contains 1 -or $apply -eq "all"){
if($verbose = $true){
Write-Output "Increasing MaxHWTransferSize size from 4MB to 16MB"
}
<#
1 | Increase MaxHWTransferSize size from 4MB to 16MB (only for Nitrogen)
Default value is 4MB
SolidFire recommended value is 16MB
Per ESXi Host Setting
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! Only applied for Nitrogen release and later !!!
!!! This setting will result in poor xcopy and write-same offload in Carbon !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Alternate method of implementation:
esxcfg-advcfg -s 16384 /DataMover/MaxHWTransferSize
or
esxcli system settings advanced set -i 16384 -o /DataMover/MaxHWTransferSize
#>
foreach ($esx in $vmhosts){
$esx | Get-AdvancedSetting -Name "DataMover.MaxHWTransferSize" | Set-AdvancedSetting -Value 16384 -Confirm:$($Confirm)
# Output completion to screen if $verbose = $true
if($verbose = $true){
Write-Output ("MaxHWTransferSize size set to 16MB for " + $esx.name)
}
}
}
##################### End Block 1 ####################################
######### Begin Block 2 | DSNRO ################################
if($apply -contains 2 -or $apply -eq "all"){
if($verbose = $true){
Write-Output "Setting DSNRO to 64"
}
<#
2 | Set DSNRO (Disk Scheduler Number Req Outstanding for a volume
Only applied to SolidFire devices
Default value is 32
Max value is 256
SolidFire recommended value is 64
Set $dsnro to your preferred value if you want something other than 64
Alternate method of implementation:
esxcli storage core device set -d naa.xxxx -O 64
#>
$dsnro = 64
foreach ($esx in $vmhosts)
{
$esxcli=get-esxcli -VMHost $esx
$devices = $esx | Get-ScsiLun | Where{$_.Vendor -match "SolidFir"}
foreach ($device in $devices)
{
If($esx.Version.Split(".")[0] -ge "6"){
#vSphere 6.x hosts or greater
$esxcli.storage.core.device.set($null, $null, $device.CanonicalName, $null, $null, $null, $null, $null, $null, $null, $null, $dsnro, $null, $null)
}else{
#vSphere 5.x hosts
$esxcli.storage.core.device.set($null, $device.CanonicalName, $null, $null, $null, $null, $null, $dsnro, $null)
}
# Output completion to screen if $verbose = $true
if($verbose = $true){
Write-Output ("DSNRO for " + $device.CanonicalName + " on host " + $esx.name + " set to " + $dsnro)
}
}
}
}
##################### End Block 2 ####################################
######### Begin Block 3 | Queue Depth ##########################
if($apply -contains 3 -or $apply -eq "all"){
if($verbose = $true){
Write-Output "Setting Queue Depth for Software iSCSI initiators to 256"
}
<#
3 | Set Queue Depth for Software iSCSI initiator to 256
Default value is 128
SolidFire recommended value is 256
Alternate method of implementation:
esxcli system module parameters set -m iscsi_vmk -p iscsivmk_LunQDepth=256
#>
foreach ($esx in $vmhosts){
$esxcli = get-esxcli -VMHost $esx
If($esx.Version.Split(".")[0] -ge "6"){
#vSphere 6.x hosts or greater
$esxcli.system.module.parameters.set($null, $null,"iscsi_vmk","iscsivmk_LunQDepth=256")
}else{
#vSphere 5.x command
$esxcli.system.module.parameters.set($null,"iscsi_vmk","iscsivmk_LunQDepth=256")
}
$esxcli.system.module.parameters.list("iscsi_vmk") | Where{$_.Name -eq "iscsivmk_LunQDepth"}
# Output completion to screen if $verbose = $true
if($verbose = $true){
Write-Output ("Queue depth for " + $esx.Name + " set to 256")
}
}
}
##################### End Block 3 ####################################
######### Begin Block 4 | DelayedAck ###########################
if($apply -contains 4 -or $apply -eq "all"){
if($verbose = $true){
Write-Output "Turning off DelayedAck"
}
<#
4 | Turn Off DelayedAck for Random Workloads
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! Only for throughput heavy workload or latency senstive applications. !!!
!!! This is a global ESXi host setting that applies to all software iSCSI !!!
!!! initiator targets on the host. !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Default application value is 1 (On)
Modified application value is 0 (Off)
Alternate method of implementation:
vmkiscsi-tool vmhba38 -W -a delayed_ack=0
NOTES from https://communities.vmware.com/message/1830738
#>
foreach($esx in $vmhosts){
$adapterID = $esx.ExtensionData.config.StorageDevice.HostBusAdapter | Where{$_.Model -match "iSCSI"}
$esxcli.iscsi.adapter.param.set($adapterID.device, $null, "DelayedAck", "false")
# Output completion to screen if $verbose = $true
if($verbose = $true){
Write-Output ("DelayedAck turned off for " + $esx.name)
}
}
}
##################### End Block 4 ####################################
######### Begin Block 5 | SATP Rule ############################
if($apply -contains 5 -or $apply -eq "all"){
if($verbose = $true){
Write-Output "Creating Custom SATP Rule"
}
<#
5 | Create Custom SATP Rule for SolidFire
Alternate method of implementation:
esxcli storage nmp satp rule add -s VMW_SATP_DEFAULT_AA -P VMW_PSP_RR -O iops=“1” -V “SolidFir" -M “SSD SAN” -e “SolidFire custom SATP rule"
add(boolean boot, string claimoption, string description, string device, string driver, boolean force, string model, string option, string psp, string pspoption, string satp, string
transport, string type, string vendor)
-s = The SATP for which a new rule will be added
-P = Set the default PSP for the SATP claim rule
-O = Set the PSP options for the SATP claim rule (option=string
-V = Set the vendor string when adding SATP claim rules. Vendor/Model rules are mutually exclusive with driver rules (vendor=string)
-M = Set the model string when adding SATP claim rule.
-e = Claim rule description
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!! When to reboot the host upon applying setting !!!
!!! Reboot host if you have already presented SolidFire storage to the host !!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
To remove the claim rule:
$esxcli.storage.nmp.satp.rule.remove($false, $null, "SolidFire custom SATP rule", $null, $null, "SSD SAN", $null, "VMW_PSP_RR", "iops=10", "VMW_SATP_DEFAULT_AA", $null, $null, "SolidFir")
#>
#>
foreach($esx in $vmhosts){
$esxcli = Get-Esxcli -VMHost $esx
$esxcli.storage.nmp.satp.rule.add($false, $null, "SolidFire custom SATP rule", $null, $null, $true, "SSD SAN", $null, "VMW_PSP_RR", "iops=10", "VMW_SATP_DEFAULT_AA", $null, $null, "SolidFir")
# Output completion to screen if $verbose = $true
if($verbose = $true){
Write-Output ("Custom SATP rule created for " + $esx.name)
}
}
<# Result Looks like:
ClaimOptions :
DefaultPSP : VMW_PSP_RR
Description : SolidFire custom SATP rule
Device :
Driver :
Model : SSD SAN
Name : VMW_SATP_DEFAULT_AA
Options :
PSPOptions : iops='1'
RuleGroup : user
Transport :
Vendor : SolidFir
#>
}
##################### End Block 5 ####################################