FlashArray VMware Best Practices PowerCLI Scripts

I wrote a post recently on the updates made to the PowerCLI 6.3 R1 esxcli implementation, so the logical next step was to implement this new behavior into my PowerCLI scripts that use esxcli. I still have a few scripts to update, but my two best practice-related scripts are ready to go. The two scripts are:

  1. Script to check and set best practices. Download here:
  2. Script to just check best practices, and lists issues in a report. Download here.

While I was updating them for esxcli changes, I figured i might as well improve them too, so there are quite a few changes for both. Let’s take a look.

 

Comments on both scripts:

Both scripts are interactive. They ask for the following information:

Log location (this is a pop-up)

vCenter IP/FQDN (this is entered via text)

vCenter credentials (a pop-up)

Cluster. By default the scripts will look at all of the hosts in a vCenter. This gives you the option to instead just look at a cluster and choose a cluster with a pop-up drop-down

The script then logs information to a log file that you specified and that location is printed to the screen.

Both scripts will attempted to install PowerCLI through the PowerShell gallery if it is not installed, and if it is, it will make sure it is loaded.

Make sure you are at least running PowerCLI 6.3 or later. The script will terminate if it is not at that release.

Best Practices Set Script

The “set” script checks for and fixes the following things:

  1. Disk.DiskMaxIO size. This is optional and only needs to be changed if you are using vSphere Replication or UEFI boot for your VMs. The script asks you this at the start. If you are intending to use these options, say yes so it will change Disk.DiskMaxIOSize to 4 MB from 32 MB.
  2. iSCSI. If the script finds any iSCSI (dynamic and/or static) targets to a FlashArray on your ESXi hosts it will ensure that LoginTimeout and DelayedAck are set properly (30 seconds and disabled respectively)
  3. Multipathing. It will ensure a SATP multipathing rule is created for the FlashArray with RoundRobin and IO Operations Limit of 1. This is SATP rule is default in ESXi 6.5 U1 and 6.0 Express Patch 5 and later by the way
  4. If there are any FlashArray devices that do not have RR and IOPS=1 set, it will set them too.
  5. It will look for any FlashArray VMFS-6 volumes and ensure automatic UNMAP is enabled. If it isn’t it enables it.

Best Practices Check Script

The “check” script checks ONLY for issues and does not change anything. It also checks for more things. It will generally only log problems, if something looks fine it will not be fully logged.

  1. Disk.DiskMaxIO size. This is optional and only needs to be changed if you are using vSphere Replication or UEFI boot for your VMs. so if you get a warning about this not being set and you are not using those features, you can ignore this.
  2. iSCSI. If the script finds any iSCSI (dynamic and/or static) targets to a FlashArray on your ESXi hosts that does not have LoginTimeout and DelayedAck set properly (30 seconds and disabled respectively)
  3. Multipathing. It will check that a SATP multipathing rule exists for the FlashArray with RoundRobin and IO Operations Limit of 1. This is SATP rule is default in ESXi 6.5 U1 and 6.0 Express Patch 5 and later by the way
  4. If there are any FlashArray devices that do not have RR and IOPS=1 set, it will log them too.
  5. It will look for any FlashArray VMFS-6 volumes and ensure automatic UNMAP is enabled. If it isn’t it enables it.
  6. Check that VAAI in general is enabled. XCOPY, WRITE SAME, ATS and ATS heartbeating
  7. Will also log specifics around devices. You will see this under each host portion in the log:

Only devices on that host with one or more issues will appear. The problematic setting will be marked with an asterisk. If the setting is irrelevant (a device isnt VMFS-6, so automatic UNMAP doesnt exist, or it isnt being used as a VMFS) the value will be N/A.

This checks for:

  1. number of paths to volume (should be at least 4)
  2. IOPS value
  3. Path Selection Policy
  4. VMFS version
  5. ATS Mode (should be ATS)
  6. Automatic UNMAP setting

Also with this, the script will log all hosts with one or more errors to the screen:

Also in the log file itself, at the top the hosts with errors are listed:

So, search the file for that name to find the host information. Or in general, just search for:

[****NEEDS ATTENTION****]

That is listed for anything that is not set properly.

Enjoy!

39 Replies to “FlashArray VMware Best Practices PowerCLI Scripts”

  1. Hi Cody,

    Thank you for your invaluable work on these scripts!
    I’m waiting for the PowerCLI 6.3 R1 version of your unmapsdk 🙂

    Ciao!


    Lorenzo

    P.S.: The Best Practices Checker link is broken(there is a typo in the ps1 file name).

  2. Hey Cody,

    Awesome blog posts and tools, thank you! One question/concern I have is with the checker script. It is my understanding that iSCSI port binding should not necessarily be used in all cases. For example, in the case of a network layout where there are multiple subnets in use for iSCSI (analogous to a ‘fabric-a’, ‘fabric-b’ in FCP world). VMware has a KB on this (2038869). Just wondering if you agree with this and if it’s worth adding an additional step(s) to you script or making at least making a special note in script about multi-subnet iSCSI configs?

    -Matt

    1. You’re welcome! Glad it is helpful to you. I will try to keep it up!

      This is a good point, I will add this to the post. Thank you!

  3. If want to only touch a certain cluster and the host under the cluster, change the line (113 in the one script, 115 in the other)
    $hosts= get-cluster | get-vmhost

  4. Quick question about these: can I run the best practices script in a Live environment without any impact? The best practices checker finds a few issues that need cleaning up and I was reasonably sure that the best practices script is only non-impacting changes but wanted confirmation. With our 3 arrays and a massive VM host refresh coming up, it would be much quicker to use this script if you can confirm non-impacting.
    Apologies if I have missed where this was answered.

    Kind regards,
    Neil Bell

  5. btw…shouldn’t this be 16384? …the logs say 16386

    [****NEEDS ATTENTION****]The VAAI XCOPY MaxHWTransferSize for this host is incorrect:
    4096
    This should be set to 16386 (16 MB).

    1. This is no longer necessary to change. I will be removing this from the script shortly. If you are using ESXi 6.5 U1 and VMFS 6 nothing in here is required. MaxHWTransferSize though can be kept at default for all versions

      1. though the “checker” script does check for other things that are important. But MaxHWTransferSize can be ignored

  6. When trying to run the checker script against a single host (named dc1a-host4-1) I receive the error:

    dc1a-host4-1 : The term ‘dc1a-host4-1’ is not recognized as the name of a cmdlet, function, script file, or operable program

    I changed line 109 to:
    $hosts= dc1a-host4-1

    What did I do wrong?

  7. Hello!

    I was wondering if you could expand on what isn’t needed for ESXi 6.5 U1. I’ll be setting up a new install in a week or two.

    Thanks!

    1. Eric,

      None of this is needed if you are on 6.5 U1. Arguably EnableBlockDelete could be turned on because you would likely have some VMFS-5 datastores still, but it’s not totally required, I would focus more on moving to VMFS-6 than worrying about this setting.

      Cody

      1. Cody,

        If I understand correctly, we don’t need this script if we’re on 6.5 U1 / VMFS6 ? So all pure best practices are default now in 6.5 U1?

        Kind regards,

        Bas

  8. Thanks Cody! This will be a complete new install so I’ll be able to start with VMFS-6. Does the SATP rule still need created? (That was my main focus when I found this post.)

    Thanks!
    Eric

  9. Sorry, I am new to PowerCLI. I was able to install the Powershell VMware.powerCLI module and can manually connect to vCenter using it but the script does not appear to be working for me. I am getting about 25 errors when it ran. I am using the most recent module from the Powershell Gallery.

    1. Nothing to apologize about! Could be a variety of things–could you show me an example of one of the errors? They are likely all related. Also–if you ever want quick support on these scripts, feel free to open a ticket with Pure Storage support–they are happy to help you even with a script. I will help as fast as I can, but they can probably help you faster.

  10. At C:\Users\swilkerson\Desktop\bestpracticechecker.ps1:133 char:19
    +
    + ~
    The ‘<' operator is reserved for future use.
    At C:\Users\swilkerson\Desktop\bestpracticechecker.ps1:137 char:19
    +
    + ~
    The ‘<' operator is reserved for future use.
    At C:\Users\swilkerson\Desktop\bestpracticechecker.ps1:142 char:19
    +
    + ~
    The ‘<' operator is reserved for future use.
    At C:\Users\swilkerson\Desktop\bestpracticechecker.ps1:147 char:19
    +
    + ~
    The ‘<' operator is reserved for future use.
    At C:\Users\swilkerson\Desktop\bestpracticechecker.ps1:151 char:19
    +
    + ~
    The ‘<input name="utf8" type="hidden" value="✓" …
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double
    quotation marks ("&") to pass it as part of a string.
    At C:\Users\swilkerson\Desktop\bestpracticechecker.ps1:2650 char:10
    +
    + ~
    The ‘<' operator is reserved for future use.
    At C:\Users\swilkerson\Desktop\bestpracticechecker.ps1:2666 char:24
    + © 2018 <span title="0.22842s from unicorn …
    + ~
    The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double
    quotation marks ("&") to pass it as part of a string.
    At C:\Users\swilkerson\Desktop\bestpracticechecker.ps1:2666 char:36
    + © 2018 <span title="0.22842s from unicorn …
    + ~
    The '<' operator is reserved for future use.
    At C:\Users\swilkerson\Desktop\bestpracticechecker.ps1:2666 char:42
    + … 2018 GitHubGitHub’ in expression or statement.
    Not all parse errors were reported. Correct the reported errors and try again.
    + CategoryInfo : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : RedirectionNotSupported

    PowerCLI C:\>

    1. Ah I see what you did. Looks like you right-clicked on the link in github and saved as ps1. This link actually points to an HTML file, so PowerShell doesnt run. CLick on the link and then choose view raw. Save the raw text (the code) as a ps1 file. That should do it.

  11. Whats the best way to delete the user added SATP rule?

    Found 2 existing Pure Storage SATP rule(s)
    [****NEEDS ATTENTION****]There is more than one rule. The last rule found will be the one in use. Ensure this is intentional.
    ———————————————–

    Checking the following existing rule:

    ClaimOptions :
    DefaultPSP : VMW_PSP_RR
    Description :
    Device :
    Driver :
    Model : FlashArray
    Name : VMW_SATP_ALUA
    Options :
    PSPOptions : iops=1
    RuleGroup : system
    Transport :
    Vendor : PURE

    This rule is correct.
    ———————————————–
    ———————————————–

    Checking the following existing rule:

    ClaimOptions :
    DefaultPSP : VMW_PSP_RR
    Description :
    Device :
    Driver :
    Model : FlashArray
    Name : VMW_SATP_ALUA
    Options :
    PSPOptions : iops=1
    RuleGroup : user
    Transport :
    Vendor : PURE

    This rule is correct.
    ———————————————–

  12. What about ATS Heartbeat on VMSF5? We regularly disable that because we’ve had occasional performance issues in the past. This best practices check scrip flags that because of VAAI ATS hardware locks. Is it a big deal to leave this disabled?
    Thanks
    Don

    1. Well it depends on your vendor on this. We (Pure) recommend having it enabled if possible–removing the use of SCSI locking is generally a performance enhancer, not the other way around. Do we absolutely require it? No. We only absolutely require ATS be enabled in general. So since you are using Pure, I would enable if possible, but we will still support you if you do not.

    1. Not really. In vSphere 7 the default multipathing policy is latency based, so it will say it is not configured correctly

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.