Hello,
our Storage configuration need to be update in order to funktion better, so we got a list of commands we need to apply.
Is it possible to script this? We have like 500 Esx Hosts. Becaus we need to apply Esxshell commands to EsxHosts and PowerCli over the vCenter
esxcli system module parameters set -p ql2xmaxqdepth=32 -m qlnativefc
Get-AdvancedSetting -Entity EsxHost -Name VMFS3.UseATSForHBOnVMFS5 | Set-AdvancedSetting -Value 0 -Confirm:$false
for i in `esxcfg-scsidevs -c | awk '{print$1}' | grep naa.600 `; do esxcli storage nmp psp roundrobin deviceconfig set --type=iops --iops=1 --device=$i; done
Get-AdvancedSetting -Entity $esx -Name Disk.DiskMaxIOSize | Set-AdvancedSetting -Value 256 -Confirm:$false | Out-Null
esxcli storage core device set --device device_uid --queue-full-threshold 32 --queue-full-sample-size 8
Moderator: Moved to PowerCLI Discussions
Not too sure what the actual question is.
The esxcli commands you can run via the Get-EsxCli cmdlet. There are numerous examples on how to do this in this community, just use the handy Search functionality.
The *-AdvancedSetting cmdlets are PowerCLI cmdlet, not sure what the question is here?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
ok it is possible that was the Question and now it is how do I do this for like
for i in `esxcfg-scsidevs -c | awk '{print$1}' | grep naa.600 `; do esxcli storage nmp psp roundrobin deviceconfig set --type=iops --iops=1 --device=$i; done
I dont even know how to make it into a Get-ESXcli and then I need so do this all for every ESX and all commands how can I do this.
It is not clear to me if that last esxcli command is for all device or only the ones where the CanonicalName starts with 'naa.600'.
If it is for all LUNs, it will require a separate loop with the the Where-Object clause.
$sMod = @{
module = 'qlnativefc'
parameterstring = 'ql2xmaxqdepth=32'
}
Get-VMHost -PipelineVariable esx |
ForEach-Object -Process {
$esxcli = Get-EsxCli -VMHost $esx -V2
$esxcli.system.module.parameters.set.Invoke($smod)
$esxcli.storage.core.device.list.Invoke() | where{$_.Device -match "^naa.600"} |
ForEach-Object -Process {
$sRR = @{
device = $_.Device
type = 'iops'
iops = 1
}
$esxcli.storage.nmp.psp.roundrobin.deviceconfig.set.Invoke($sRR)
$sDev = @{
device = $_.Device
queuefullthreshold = 32
queuefullsamplesize = 8
}
$esxcli.storage.core.device.set.Invoke($sDev)
}
Get-AdvancedSetting -Entity $esx -Name VMFS3.UseATSForHBOnVMFS5 |
Set-AdvancedSetting -Value 0 -Confirm:$false | Out-Null
Get-AdvancedSetting -Entity $esx -Name Disk.DiskMaxIOSize |
Set-AdvancedSetting -Value 256 -Confirm:$false | Out-Null
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
Those parameters, like NMP SATP rules are set per Vendor instead of per LUN.
This is an example for PURE storage.
Get-VMhost | Get-EsxCli –V2 | % {$_.storage.nmp.satp.rule.add.Invoke(@{description='Pure Storage FlashArray SATP';model='FlashArray';vendor='PURE';satp='VMW_SATP_ALUA';psp='VMW_PSP_RR'; option='iops=1'})}
Most of the storage providers shared their best practices with the relevant parameters.
Thanks LucD I will try this script next week when I have time and the last one sets the command to all CanonicalName starts with 'naa.600'
and megotloves I try to keep that in mind and change it.
Hello Lucd,
I just tried you script and it didnt work for me I get:
and at the end of you script there is a missing } or?
Message: EsxCLI.CLIFault.summary;
InnerText: Unknown device EsxCLI.CLIFault.summary
In Zeile:18 Zeichen:9
+ $esxcli.storage.nmp.psp.roundrobin.deviceconfig.set.Invoke($s ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], MethodFault
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.MethodFault
Message: EsxCLI.CLIFault.summary;
InnerText: Unable to find device with name EsxCLI.CLIFault.summary
In Zeile:24 Zeichen:9
+ $esxcli.storage.core.device.set.Invoke($sDev)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], MethodFault
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.MethodFault
Did you check that the following line is returning something?
$esxcli.storage.core.device.list.Invoke() | where{$_.Device -match "^naa.600"}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
sry I was missing the } after "naa.600"
now I get Message: EsxCLI.CLIFault.summary;
InnerText: Unable to set device's queue-full-threshold or queue-full-sample-size. Error was: Cannot set device qfull parameters. queue-full-threshold should be <= queue-full-sample-size.EsxCLI.CLIFault.summary
In Zeile:24 Zeichen:9
+ $esxcli.storage.core.device.set.Invoke($sDev)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], MethodFault
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.MethodFault
I think the error is clear, the value on the threshold parameter must be smaller or equal than the value on the samplesize parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
haha sry yeah just read the **bleep**ing text there would helped.
thanks for the help I think I need to contact IBM for that because there submitted the wrong parameters for that.
Then the script is working great.