Hi,
I want to run this command on all the hosts in a cluster for enabling the Multipathing for a storage LUN created.
esxcli storage core device set -d <device> -O 256;
esxcli storage nmp device set --device <device> --psp VMW_PSP_RR;
esxcli storage nmp psp roundrobin deviceconfig set --type=iops --iops=1 --device=<device>;
I tried many times using the Powercli, but not able to get a good arguement for the commands, below is the script I have created
$VMhosts = Get-Cluster <ClusterName> | Get-VMHost
foreach($VMhost in $VMhosts){
$esxcli = get-vmhost $VMhost | Get-EsxCli
$esxcli.storage.core.device.set($true,$null,<device>,$false,$null,$null,128,$null,$null,$null,$null)
----------------------------------------------------------------
ESXI version 6.0, powercli version 6.5
Thanks,
vivek
The value is the same as for the regular esxcli command you mentioned.
Yes, you can filter on any property that is returned for a LUN.
All esxcli commands can be done through the Get-EsxCli cmdlet.
See PowerCLI 6.3 R1: Get-ESXCLI Why the V2? for more details.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You dont need to use esxcli, you can change the pathing policy using Set-Scscilun e.g.
Get-Cluster ClusterName | Get-VMHost | Get-ScsiLun -luntype disk | Where {$_.MultipathPolicy -notlike "RoundRobin"} | Set-Scsilun -MultiPathPolicy RoundRobin
Moderator: Moved to PowerCLI
If you want to avoid the very slow Get-ScsiLun and Set-ScsiLun cmdlets, you better use the Get-EsxCli cmdlet.
With the introduction of the V2 switch, it also has become a whole lot easier to pass the parameters.
See PowerCLI 6.3 R1: Get-ESXCLI Why the V2? for details on that.
As an example, the following will run the 'esxcli storage core device set' command against each DASD LUN in each ESXi node in a cluster.
You can, of course, adapt the Where-clause to only pick the LUNs you want.
Something like this.
ForEach-Object -Process {
$esxcli = Get-EsxCli -VMHost $_ -V2
$esxcli.storage.core.device.list.Invoke() | where{$_.DeviceType -eq 'Direct-Access'} |
ForEach-Object -Process {
$myArgs = @{
device = $_.Device
schednumreqoutstanding = 256
}
$esxcli.storage.core.device.set.Invoke($myArgs)
}
}
You can easily create a skeleton hash table for the Invoke call with the CreateArgs call.
It will show you the type of each parameter and if it is optional or not.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks for the sscript, is this value for MaxI/O requests (NoofoutstandingIOswithcompetingworlds or DEviceMaxQUe Depth) ?
Here I can use my "naa.device" name instead of "Direct access", right ? $esxcli.storage.core.device.list.Invoke() | where{$_.DeviceType -eq 'Direct-Access'} |
What about these two commands ??
esxcli storage nmp device set --device <device> --psp VMW_PSP_RR;
esxcli storage nmp psp roundrobin deviceconfig set --type=iops --iops=1 --device=<device>;
The value is the same as for the regular esxcli command you mentioned.
Yes, you can filter on any property that is returned for a LUN.
All esxcli commands can be done through the Get-EsxCli cmdlet.
See PowerCLI 6.3 R1: Get-ESXCLI Why the V2? for more details.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference