in fact I do not know how to Set/Get the IOPS parameter of a lun.Can you help me ?
In summary I would like to translate the following scripts to powershell. If you are able to provide how to access to IOPS I'll take care of the loop separetly...
Set script
for i in `ls /vmfs/devices/disks/ | grep naa.600` ; do esxcli nmp roundrobin setconfig --type "iops" --iops=1 --device $i ;done
Get Script
for i in `ls /vmfs/devices/disks/ | grep naa.600` ; do esxcli nmp roundrobin getconfig --device $i ;done
extra from HP best practices for EVA
Joe,
The powercli is wrong afaik. Remove both lines and replace with
$esxcli.nmp.satp.setdefaultpsp("VMW_PSP_RR", "VMW_SATP_ALUA")
That should do the trick. But this only changes the default psp, that is assigned to new luns that are discovered by that satp. It does not change the policy for the luns that are already present.
Arnim
Good news and bad news, good news: I presented a 100gb LUN to the test box, got the nmp settings and saw it is VMW_PSP_RR and VMW_SATP_ALUA as expected. But the set IOPs portion is still throwing the MethodInvocationException errors on the getconfig and setconfig lines.
thanks
Joe
Just a quick check, what does this return for you ?
$esxcli.nmp.device.list() | where {$_.device -like "naa.600*"} | Select Device,PathSelectionPolicy,StorageArrayType
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The first device in the list (ending with 3f40000) is the newly presented LUN
Device : naa.600508b4000d080a0001300003f40000
PathSelectionPolicy : VMW_PSP_RR
StorageArrayType : VMW_SATP_ALUA
Device : naa.600508b4000d080a0001300000ca0000
PathSelectionPolicy : VMW_PSP_MRU
StorageArrayType : VMW_SATP_ALUA
Got it: a mix up of variables. It was staring me in the face but I missed it:
$esxcli = Get-EsxCli -Server $vmhost
$esxcli.nmp.device.list() | where {$_.device -like "naa.600*"}| %{
$configBefore = $esxcli.nmp.roundrobin.getconfig($_.device)
$esxcli.nmp.roundrobin.setconfig(0,$configbefore.device,[long]1,"iops",$false)
$configAfter = $esxcli.nmp.roundrobin.getconfig($_.device)
$configBefore
$configAfter
}
thanks for all ya'll's help!
Joe
Are you sure ?
I still see the "internal server error" when the PSP is set to VMW_PSP_MRU.
And I tend to agree with Arnim that this looks like a bug in the Get-EsxCli cmdlet.
With the esxcli command it works without a problem.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
OK, how about this portion of the script is working normally now. I am about to incorporate it in the full script and destroy and rebuild my test box.
Here are the configbefore and configafter results:
ByteLimit : 10485760
Device : naa.600508b4000d080a0001300003f40000
IOOperationLimit : 1000
LimitType : Default
UseActiveUnoptimizedPaths : false
ByteLimit : 10485760
Device : naa.600508b4000d080a0001300003f40000
IOOperationLimit : 1
LimitType : Iops
UseActiveUnoptimizedPaths : false
I’ll post the results of the full install shortly…
Great news, all working with no error.
As far as the set _RR portion of the script, that works only for FUTURE presentations. (I've destroyed and rebuilt 2 times and got the same behaviour)
As for the set IOPS=1, that only works for CURRENT presentations.
So I split my powercli script into two parts, one set DNS, NTP, vSwitches, _RR etc, then I run a script to present the LUNs, then run the second script for IOPs. Worked error free.
Great news indeed.
Why don't you post your script as a Document ?
I think the use of the Get-EsxCli cmdlet is still uncharted area for most users, every example would be welcome 🙂
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Sure...here they are, and here's how I am doing it, until I make it a little more graceful:
1. PXE boot to KS script (sets vswitch0, iSCSI and assgns vnknics to the VMBHAxx)
2. Script 1
3. Present LUNs
4. Script 2
Done.
I still have a little tweaking to do, but this is working fine for the time being.
Joe
Thanks Joe.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You've probably already figured it out by now, but you can also set RoundRobin policy on already connected LUNs through Powershell.
I'll include the script i use, just as future reference for people trying to do the same thing.
script will take the vcenter ip or hostname, and part of the LUNs canonical name (naa.600...., use whatever part that matches all the LUNs you want to set RR on) as parameters.
RR policy will be set on all matching LUNs, on all hosts, in all clusters across your datacenter.
This is just a script i found somewhere, and edited a bit to use parameters.
I also have a second one that sets the iops, copied from this thread and modified to take parameters (ESX host and diskid) like the first.
Next step is combining the two to have RR policy and iops set in one go.
I wrote a blog post about this:
http://www.van-lieshout.com/2011/01/esxcli-powercli/
shows you how to do it all in one run.
Has anyone found a way to set it up to that the default setting for IOPS=1 for all future LUNs?
Arnim,
I'm trying your script and getting this error. Please help!
Connect-VIServer $esx -Credential <<<< $esxCred | Out-Null
Connect-VIServer : The argument cannot be null or empty.
At C:\temp\set_mpath_iops.ps1:13 char:35
I'm using PoweCLI 4.1.1 at vCenter and ESXi 4.1.
If you don't have credentials stored in the variable, you can prompt for them.
Something like this
Connect-VIServer $esx -Credential (Get-Credential) | Out-Null
Or you can promtp before with this
$esxCred = Get-Credential
Connect-VIServer $esx -Credential $esxCred | Out-Null
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
$esxCred needs to contain your esx credentials. Use:
$esxCred = get-credential
Or use -username and -password parameters instead.
You need to provide login credentials for your esx host.
Arnim
Sent from my iPad
Don't know how to set iops=1 as default, but i finished my script for setting RR and iops in one go.
Every time a lun is added, i just rerun the script.
script loads the vmware snap-in itself, so you can just start it using 'run with powershell' from the right-click menu, without having to start vsphere powercli first.
Prompts for vcenter and esx host credentials (assumes host credentials are identical for all hosts)
vcenter address, diskID and SATP for your array should be set as variables. (eg VMW_SATP_ALUA for HP EVA or VMW_SATP_DEFAULT_AA for EMC NX4, just check what ESX chooses)
The setting the roundrobin part from Arnim wouldn't work for me, so i used that part from the other script.
Added a sleep for 20 seconds at the end, so you can see what changed (shows iops before and after).
Somebody award patrickds some points!