Flapoly
Contributor
Contributor

How to configure IOPS with powerCLI

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

http://h20195.www2.hp.com/V2/GetPDF.aspx/4AA1-2185ENW.pdf

38 Replies
LucD
Leadership
Leadership

I'm afraid that is not possible (yet).

See also

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Flapoly
Contributor
Contributor

Thks - again - to lucD for a valuable answer.

- We have a large environment (several vCenter & ESXi hosts) where the whole configuration, monitoring and compliance monitoring is done with powershell (ie under windows)

I do not see how an esxcli can be introduced with our ESXi lockdown policy...

So in i do not think esxcli can currently make the job in our environment.

PS: what do you means by "yet" does VMware will provide a solution in the next few days/week ?

0 Kudos
LucD
Leadership
Leadership

I said "yet" because the esxcli utility currently uses a non-public API for this.

And I guess that the API could/should become public one day (especially since ESXi will be the future).

The alternative, like mentioned in , is to use vMA.

But vMA is imho not the ideal solution for shops that decided to go the PowerCLI way.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
joeduke
Contributor
Contributor

Is this now possible with the new powercli 4.1.1-33244?

for i in `esxcli nmp device list | grep ^naa.600`;
do esxcli nmp roundrobin setconfig --type "iops" --iops=1 --device $i;
done;

TIA

Joe

0 Kudos
LucD
Leadership
Leadership

Sure is.

You could do it like this.

Connect to the ESX server

Run a script similar to this

$esxcli = Get-EsxCli
$esxcli.nmp.device.list() | where {$_.device -like "naa.600*"} | %{
    $configBefore = $esxcli.nmp.roundrobin.getconfig($_.device)
    $esxcli.nmp.roundrobin.setconfig(0,$_.device,[long]1,"iops",$false)
    $configAfter = $esxcli.nmp.roundrobin.getconfig($_.device)

# Uncomment the following lines if you want to report the settings before and after

#   $configBefore
#   $configAfter
}

The first parameter in setconfig method is not used when the type is "iops".

To see the parameters and their description you can do

$esxcli.nmp.roundrobin.help("setconfig")


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
joeduke
Contributor
Contributor

looks like that worked, but the new powercli broke some other things.

Is there a list of commands no longer available or to what they were changed? (Attach-Baseline comes to mmind first)

(nothing listed here: http://www.vmware.com/support/developer/PowerCLI/changelog.html#PowerCLI41U1 )

thanks for you help!

Joe

0 Kudos
LucD
Leadership
Leadership

The Attach-Baseline cmdlet belongs to the Update Manager snapin.

Is the snapin loaded ?

What error do you get ?

It still works for me.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
joeduke
Contributor
Contributor

AHA!  I did not reload the snap in.. duh.

thanks!
Joe

0 Kudos
joeduke
Contributor
Contributor

LucD,

    the other day I ran the script and returned no errors (perhaps I was not paying close enough attention) but now I get plenty.

The remote server returned an error: (500) Internal Server Error.
At C:\test4.ps1:26 char:53
+     $configBefore = $esxcli.nmp.roundrobin.getconfig <<<< ($_.device)
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodInvocationException

The remote server returned an error: (500) Internal Server Error.
At C:\test4.ps1:27 char:37
+     $esxcli.nmp.roundrobin.setconfig <<<< (0,$result.device,[long]1,"iops",$
alse)
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodInvocationException

The remote server returned an error: (500) Internal Server Error.
At C:\test4.ps1:28 char:52
+     $configAfter = $esxcli.nmp.roundrobin.getconfig <<<< ($_.device)
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : MethodInvocationException

line26, char53 refers to  this command:  $configBefore = $esxcli.nmp.roundrobin.getconfig($_.device)

line 27, char37 refers to this command: $esxcli.nmp.roundrobin.setconfig(0,$result.device,[long]1,"iops",$false)
line 28, char52 refers to this command:    $configAfter = $esxcli.nmp.roundrobin.getconfig($_.device)

It appears to me that this commnad is returing a null value $esxcli.nmp.device.list() | where {$_.device -like "naa.600*"}, but when run by itself, returns the value expected:

Device                          : naa.600508b4000d080a0001300000ca0000
DeviceDisplayName               : HP Fibre Channel Disk (naa.600508b4000d080a00
                                  01300000ca0000)
PathSelectionPolicy             : VMW_PSP_MRU
PathSelectionPolicyDeviceConfig : Current Path=vmhba1:C0:T1:L1
StorageArrayType                : VMW_SATP_ALUA
StorageArrayTypeDeviceConfig    : {implicit_support=on;explicit_support=on; exp
                                  licit_allow=on;alua_followover=on;{TPG_id=1,T
                                  PG_state=ANO}{TPG_id=2,TPG_state=AO}}
WorkingPaths                    : {vmhba1:C0:T1:L1}

any advice?

thanks

Joe

0 Kudos
LucD
Leadership
Leadership

You are connected to the ESX server and not the vCenter server I assume ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
joeduke
Contributor
Contributor

Es, I am connected to the esxhost.

0 Kudos
LucD
Leadership
Leadership

And is that an ESX 4.x host ?

Note that with ESX 4.0 some commands don't work, with ESX 4.1 they should all work.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
joeduke
Contributor
Contributor

This is an ESXi 4.1.0 (VMkernel 320137) host

0 Kudos
avlieshout
VMware Employee
VMware Employee

This is probably because the device that you're trying to configure doesn't have the roundrobin PSP assigned.

Try $esxcli.nmp.device.list(naa.xxxxxxx) to determine the active PSP for the device.

Arnim

Arnim van Lieshout Blogging: http://www.van-lieshout.com Twitter: http://www.twitter.com/avlieshout If you find this information useful, please award points for "correct" or "helpful".
0 Kudos
joeduke
Contributor
Contributor

Yes, I see now it is set to MRU, these two lines of code were supopsed to have address that, but I see errors on line 1, line 2 works:

$esxcli.nmp.psp.setdefaultpsp("VMW_PSP_RR","PSP")
$esxcli.nmp.satp.setdefaultpsp("VMW_SATP_ALUA","SATP")

0 Kudos
joeduke
Contributor
Contributor

This is what I'm trying to accomplish, from our kick start script to powercli:

# -------------------------------------------------------------------------------------
# Change the default path selection policy to Round-Robin (for ALUA)
#
#esxcli nmp satp setdefaultpsp --satp VMW_SATP_ALUA --psp VMW_PSP_RR

#--------------------------------------------------------------------------------------
# Set IOPS for HP EVA 4400 (naa.600)
#
for i in `esxcli nmp device list | grep ^naa.600`;
do esxcli nmp roundrobin setconfig --type "iops" --iops=1 --device $i;
done;

Maybe that will help shed more light on it..

thanks agian

Joe

0 Kudos
LucD
Leadership
Leadership

But that is exactly the script I gave at the beginning of this thread.

Or am I missing something ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
joeduke
Contributor
Contributor

You’re not missing anything, but it’s this line(s) that fail in the powercli script

KS version: #esxcli nmp satp setdefaultpsp --satp VMW_SATP_ALUA --psp VMW_PSP_RR

Powercli version: $esxcli.nmp.psp.setdefaultpsp("VMW_PSP_RR","PSP")

$esxcli.nmp.satp.setdefaultpsp("VMW_SATP_ALUA","SATP")

And not setting RR, thus the remainder fails due to no RR being set.

Sorry to confuse the mater…

Joe

0 Kudos
LucD
Leadership
Leadership

Ok, I'm with you now 🙂

Don't have access to my testlab right now.

Will check later.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos