With the new improvements to vSphere native mulit pathing (NMP) in 5.1 I wanted to change all my LUNS to use Round Robin as per the new EMC best practice with my VNX flare code.
However I also have MSCS clusters which only support Fixed mode as per http://kb.vmware.com/kb/1037959.
Subsequently I want to get all my VMFS volumes and set them to Round Robin, and leave all my RDMs set to Fixed.
I am hoping to do this dynamically so I can leave it with the admin here to run whenever he wants, but I am struggling to get this done.
What I’ve tried so far.
I can get all my LUNs with these command.
$esxcli
= Get
-EsxCli
$Allmyluns = Get-esxcli.storage.nmp.device.list() | Where {$_.device -like "naa.*"}
I can get all my RDMs with this command
$RDMS = get-vm | get-harddisk | where {$_.SCSIcanonicalname – like “naa.*” | select SCSIcanonicalname
I can set the method once I have the storage by doing this
$esxcli
= Get
-EsxCli
Foreach ($lun in $allmyluns({
$esxcli.nmp.device.setpolicy($null, $_.Name,
"VMW_PSP_RR")
}
I have also thought about writing a csv or text file with the first command and trying to remove the entries with the second command but that is a bit past me, and I may be trying to over-complicate things unnecessarily
.
But what I can’t do is work out how to get a list whenever I want that has all the VMFS LUNS but not any of the RDM LUNS. So I can dynamically feed this into a script which updates VMFS pathing to Round Robin.
Any help, input or ideas would be greatly appreciated
This should get you all the VMFS LUNs.
Get-Datastore | where {$_.Type -eq "VMFS"} | %{
$_.ExtensionData.Info.Vmfs.Extent | %{
$_.DiskName
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
This should get you all the VMFS LUNs.
Get-Datastore | where {$_.Type -eq "VMFS"} | %{
$_.ExtensionData.Info.Vmfs.Extent | %{
$_.DiskName
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You don't really need to explicitly set your VMFS volumes to round robin, you can change the default PSP for your array type then reboot the host and everything will be set to round robin by default including any new luns in the future so all you would need to pay attention to is any new RDMs.
I run this command on each host to set the default to round robin. You will to change the "VMW_SATP_ALUA_CX" to whatever SATP your array uses.
$esxcli.storage.nmp.satp.set($null,"VMW_PSP_RR","VMW_SATP_ALUA_CX")
Then I have this to find RDMs and set them to MRU on a cluster basis.
$cluster = "Cluster Name"
$vmhosts = Get-Cluster $cluster | Get-VMHost
$vms = Get-Cluster $cluster | Get-VM
$rdms = $vms | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select -Unique ScsiCanonicalName
foreach($vmhost in $vmhosts){
$esxcli = get-esxcli -VMHost $vmhost
foreach($rdm in $rdms){
$naaid = $rdm.ScsiCanonicalName
Write-Host "Setting RDM $naaid to perenially reserved on host $vmhost"
$esxcli.storage.core.device.setconfig($false, "$naaid", $true)
Write-Host "Setting MPP on $naaid on host $vmhost"
$esxcli.storage.nmp.device.set($null, "$naaid", "VMW_PSP_MRU")
}
}
I could also do it with the EMC VSI if i wanted to change ALL to round robin but then my ms cluster vms would go to round robin and that would be BAD as they then go into flap and the clusters fail and that is why they are unsupported on round robin. Hence the post. Thanks though.
Also thankyou for some of the syntax in the variables above, they got used, much appreciated.