Skip to content

Best practices enforcement for Datera devices in VMware environments

License

Notifications You must be signed in to change notification settings

Datera/Datera-VMware-best-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PowerCLI script to check/configure Datera Best Practices on ESXi hosts

Preparation 1 - Install Powershell on the node you want to run the script
-------------------------------------------------------------------------
    MacOS:
        1. brew cask install powershell
        2. Verify if PowerShell 6.2.2 installed by "pwsh" command
    Ubuntu (16.04):
        1. Download powershell_6.2.2-1.ubuntu.16.04_amd64.deb
        2. Use "sudo apt-get install <package>" command to install PowerShell 6.2.2
    Windows (Windows 2012 R2)
        Powershell installed by default

Preparation 2 - Install VMware PowerCLI on the node you want to run the script
------------------------------------------------------------------------------
        1. Go to powershell console
        2a. On Linux/MacOS run the command
            PS> Install-Module -Name VMware.PowerCLI
        2b. On Windows run the command
            PS> Install-Module -Name VMware.PowerCLI -RequiredVersion 6.5.4.7155375

Features
--------
    Powercli script Datera_VMWare_setup.ps1 is a tool to display and configure
    several storage or iSCSI parameters on ESXi hosts via vCenter based on
    Datera VMware Best Practices.

    ### Datera requires these parameters to be set on ESX hosts ###
        - ATS heartbeat                     -- Disabled for Datera versions 3.3.5.2 and below
        - ATS heartbeat                     -- Enabled for Datera versions 3.3.5.3 and above
        - iSCSI Queue Depth                 -- 16 (configurable in constants.ps1)
        - DelayedACK of SW iSCSI adapter    -- Disabled
        - DATERA NMP SATP rule              -- Round Robin and IOPS=1 for Datera storage
        - Automatic Queue Depth control for each LUN (configurable in constants.ps1)
                                            -- QueueFullSampleSize = 32
                                            -- QueueFullThreshold = 4

    ### How to run ###
        1. Download/clone the github repository into your current directory
        2. Start Powershell console
        3a. Run the script in its simplest form:
            PowerCLI C:\> .\Datera_VMWare_setup.ps1 - the script will prompt for all its
                                                      required parameters
        3b. Run the script in corrective mode (this is disruptive and should be used with caution)
            PowerCLI C:\> .\Datera_VMWare_setup.ps1 -Update $true
        Other examples:
        3c. Run in succinct mode
            PowerCLI C:\> .\Datera_VMWare_setup.ps1 -succinct $true
        3d. Run in verbose mode
            PowerCLI C:\> .\Datera_VMWare_setup.ps1 -verb $true
        3e. Pass the vCenter/ESXi DNS name
            PowerCLI C:\> .\Datera_VMWare_setup.ps1 -vCenterServer <vcenter.example.com>
        3f. Pass the vCenter/ESXi DNS name and credentials, run in verbose mode
            PowerCLI C:\> $mycredentials = Get-Credential
            PowerCLI C:\> .\Datera_VMWare_setup.ps1 -vCenterServer <vcenter.example.com>
                          -vCredential $mycredentials -verb $true

    ### Script parameters
        * For a complete and most up to date description of the script parameters,
          please refer to the comments in the script itself.

        -Update (bool, default $false)
            Attempt to correct the deviations from best practices found
        -vCenterServer (string, mandatory, no default)
            This is the FQDN of the vCenter Server E.g. vcenter.example.com
        -vCredential (PSCredential, mandatory, no default)
            This is the account that you will use to connect to vCenter
        -verb (boolean, default $false)
            Verbose. If you want lighter feedback, enable the succinct flag.
        -succinct (boolean, default $false)
            Summary output throughout the script. For more feedback, try the verbose flag.
        -version (string, default "3.3.5.2")
            Datera software version. This is used to determine how the ATS HB should be set.
        -sendEmail (boolean, default $false)
            Send an email for script execution. Set proper parameters in constants.ps1
        
    ### Tested environments ###
    We did test the script in the following environments:
        1)  ESXi 6.0u3 and vCenter 6.0 u3h
        2)  ESXi 6.5u2 and vCenter 6.5 u2d
        3)  ESXi 6.7u2 and vCenter 6.7 u2c

FAQ
---

Q: Why do we need to setup these parameters?
A: The details can be found in the comments in the source of Datera_VMWare_setup.ps1  

Q: Why is the script skipping some of my ESXi hosts?
A: The script will purposefully skip ESXi host(s) that have iSCSI targets configured,
   to avoid damaging your ESXi server configuration. This script is intended to be run
   when a new ESXi host is added to vCenter Server.

Q: I am getting the following error on MacOS, and my screen looks grabbled, what to do?
    sort: invalid option -- D
A: In its infinite wisdom, Microsoft decided it's a good idea to overload system names.
   TL/DR version: set an Alias for sort
   PS> Set-Alias -Name sort -Value Sort-Object -Scope Global
   
   For a more in depth explanation, check
   PowerShell/PowerShell#567

Q: How can I create a PSCredential object to pass to the script?
A: PS> $mycredentials = Get-Credential

Q: How can I create a SECURE PSCredential object to pass to the script?
A: PS> $secpasswd = "<my_password>" | ConvertTo-SecureString -asPlainText -Force
   PS> $username = "vsphere.local\administrator" 
   PS> $mycreds = New-Object System.Management.Automation.PSCredential ($username, $secpasswd)

Q: I am getting for following error:
   Exception
    + FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,
    Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
A: You already have a version of VMware PowerCLI module installed,
   please add -AllowClobber to your install command, to allow PS to overwrite the commands, e.g.
   PS> Install-Module -Name VMware.PowerCLI -RequiredVersion 6.5.4.7155375 -AllowClobber

About

Best practices enforcement for Datera devices in VMware environments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published