Hi
We have recently moved some of our systems from Esxi .5 to Esxi 6.5 and when running our powershell script to set the appropriate parameters we have come upon an issue where the Storage Core Devise Set command has changed. I can find examples of how to set the QueueFullThreshold and QueueFullSampleSize via Esxcli on each host by using
esxcli storage core device set --device device_name --queue-full-threshold 4 --queue-full-sample-size 32
However I would like to be able to update our PowerCLi script so that it then runs through and updates all the hosts.
Previously the following parameters were needed
{void set(boolean defaultname, string device, boolean force, string name, boolean nopersist, long queuefullsamplesize, long queuefullthreshold, long schednumreqoutstanding, string state)}
Which was carried out using the following $ESXCli.storage.core.device.set($True,$thisLUN.CanonicalName,$False,$null,$False,$QueueFullSample,$QueueFullThreshold,$null,$null)
However I am unsure what is needed for the new parameters.
{boolean set(boolean dataintegrityenabled, boolean defaultname, string device, boolean force, long ledduration, string ledstate, long maxqueuedepth, string name, boolean nopersist, long queuefullsamplesize, long queuefullthreshold, long schednumreqoutstanding, string state, boolean writecacheenabled)}
All I need to set is the long queuefullsamplesize, long queuefullthreshold settings
Any help would be appreciated as I am new to the PowerCli and its commands. I think I have figured out testing for the host version so it issues the correct command for each device.
That is where the V2 parameter comes in handy.
$esxcli = Get-EsxCli -VMHost MyEsx -V2
You can now check (with the CreateArgs method) which parameters are present, and more importantly which ones are required and which ones are optional.
$esxcli.storage.core.device.set.CreateArgs()
This produces something like this
Everything, except device is optional.
We can now only package the required parameters in a hash table, and use the Invoke() method.
Something like this for example (it does this for all devices produced by the list method).
You can limit which devices are getting the new settings by using a Where-clause.
In this example, I only use the LUNs that are behind datastores that start with MyDS.
$esxcli.storage.core.device.list.Invoke() |
where{$_.DisplayName -match "^MyDS"} |
ForEach-Object -Process {
$arr = @{
device = $_.device
queuefullsamplesize = 32
queuefullthreshold = 4
}
$esxcli.storage.core.device.set.Invoke($arr)
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That is where the V2 parameter comes in handy.
$esxcli = Get-EsxCli -VMHost MyEsx -V2
You can now check (with the CreateArgs method) which parameters are present, and more importantly which ones are required and which ones are optional.
$esxcli.storage.core.device.set.CreateArgs()
This produces something like this
Everything, except device is optional.
We can now only package the required parameters in a hash table, and use the Invoke() method.
Something like this for example (it does this for all devices produced by the list method).
You can limit which devices are getting the new settings by using a Where-clause.
In this example, I only use the LUNs that are behind datastores that start with MyDS.
$esxcli.storage.core.device.list.Invoke() |
where{$_.DisplayName -match "^MyDS"} |
ForEach-Object -Process {
$arr = @{
device = $_.device
queuefullsamplesize = 32
queuefullthreshold = 4
}
$esxcli.storage.core.device.set.Invoke($arr)
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD will give that a go and report back
Hi
Worked a treat
Once again many thanks