PowerCLI

 View Only
  • 1.  How to adjust HBA timeout through PowerCLI

    Posted Jun 02, 2017 07:05 PM

    Hello:

    I wonder if there is a way to adjust and check HBAs timeout on ESXi host via PowerCLI.

    I know the commands I can run from the console, but cannot figure out if there is an option to do it through PowerCLI.

    Here are the two commands:

    command to check:  /usr/lib/vmware/vmkmgmt_keyval/vmkmgmt_keyval -a | grep devloss-tmo

    command to set (to 30 seconds at this case): esxcli system module parameters set -p "lpfc_devloss_tmo=30" -m lpfc

    Thank you!



  • 2.  RE: How to adjust HBA timeout through PowerCLI

    Posted Jun 02, 2017 07:41 PM

    I don't know how to retrieve the HBAs timeout. You can use PowerCLI to execute esxcli commands. The following PowerCLI commands will set the HBA time for host 192.168.0.201:

    $esxcli = Get-VMHost -Name 192.168.0.201 | Get-EsxCli

    $esxcli.system.module.parameters.set($null,$null,'lpfc','lpfc_devloss_tmo=30')



  • 3.  RE: How to adjust HBA timeout through PowerCLI

    Posted Jun 02, 2017 08:07 PM

    Thanks a lot for your reply!

    However, when I ran it it gives me error:

    The method 'set' is invoked with '4' parameters, but the expected parameter count is '3'.

    At line:6 char:1

    + $esxcli.system.module.parameters.set($null,$null,'lpfc','lpfc_devloss_tmo=30')

    Should I get rid of one $null and run "$esxcli.system.module.parameters.set($null,'lpfc','lpfc_devloss_tmo=30')" instead?

    Thank you!



  • 4.  RE: How to adjust HBA timeout through PowerCLI
    Best Answer

    Posted Jun 03, 2017 07:33 AM

    The parameter set is depending on the vSphere version. I have tested against an ESXi v6.0U2 server.

    You can see the parameters needed using the following command:

    $esxcli.system.module.parameters.set

    The output of the preceding command is the following for me:

    TypeNameOfValue     : VMware.VimAutomation.ViCore.Util10Ps.EsxCliExtensionMethod

    OverloadDefinitions : {boolean set(boolean append, boolean force, string module, string parameterstring)}

    MemberType          : CodeMethod

    Value               : boolean set(boolean append, boolean force, string module, string parameterstring)

    Name                : set

    IsInstance          : True

    In the value of the OverloadDefinitions and Value properties, you can see the parameter set, where append is the first parameter, force is the second parameter, module is the third parameter and parameterstring is the fourth parameter. For the parameters you don't want to specify, you have to use $null.

    Another solution will be to use the Get-EsxCli version 2 interface with the -V2 parameter. In this case, you can get the parameters in a hash table using the CreateArgs() method, using the following commands:

    $esxcliv2 = Get-VMHost -Name 192.168.0.201 | Get-EsxCli -V2

    $Parameters = $esxcliv2.system.module.parameters.set.CreateArgs()

    Now, the variable $Parameters contains the parameter set in the following hash table:

    Name                           Value

    ----                           -----

    module                         Unset, ([string])

    parameterstring                Unset, ([string])

    append                         Unset, ([boolean], optional)

    force                          Unset, ([boolean], optional)

    You can set the required parameter values

    $Parameters['module'] = 'lpfc'

    $Parameters['parameterstring'] = 'lpfc_devloss_tmo=30'

    And finally, use the Invoke() method to run the following command with the parameter set:

    $esxcliv2.system.module.parameters.set.Invoke($Parameters)



  • 5.  RE: How to adjust HBA timeout through PowerCLI

    Posted Jun 05, 2017 08:18 PM

    Thank you very much for your help!  It's exactly what I was looking for!



  • 6.  RE: How to adjust HBA timeout through PowerCLI

    Posted Jun 09, 2017 05:08 PM

    I can set it just fine, but is there a way to check the value for "lpfc_devloss_tmo" via PowerCLI?

    Thanks a lot!