HP 3PAR StoreServ PowerShell Toolkit Installation

HP recently released a PowerShell toolkit for the 3PAR StoreServ SAN. This is great news if you are familiar with the Microsoft PowerShell environment and wish to leverage it to manage your 3PAR arrays. Today I’m going to deploy the 3PAR PowerShell toolkit and demonstrate some of the commands that can be leveraged.

 

Download Details and System Requirements

The toolkit can be downloaded from the following link, note you will have to login with your HP account to gain access. The version currently available is 1.0 and we expect future updates to bring great functionality.

https://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=3PARPSToolkit

The following 3PAR operating system firmware versions are supported –

  • 3.1.1 (including all Major Updates)
  • 3.1.2 (including all Major Updates)
  • 3.1.3 (including all Major Updates)
  • 3.2.1 (including all Major Updates)

HP support the toolkit on the following Microsoft Windows operating systems –

  • Windows 7
  • Windows 7 SP1
  • Windows 8
  • Windows 8.1
  • Windows Server 2008 SP1
  • Windows Server 2008 R2
  • Windows Server 2008 R2 SP1
  • Windows Server 2012
  • Windows Server 2012 R2

Note – PowerShell version 2.0 and above are supported.

 

Toolkit Features

The HP documentation provides the following information with regard to the toolkit features –

The PowerShell Toolkit supports cmdlets, which are a wrapper around the native HP 3PAR StoreServ Storage CLI commands.

  • When a cmdlet is run, the following actions take place:
    • A secure connection to the HP 3PAR StoreServ Storage console is established over Secure Shell.
    • The native HP 3PAR StoreServ Storage CLI command and parameters are formed based on the PowerShell cmdlet and parameters.
    • The native HP 3PAR StoreServ Storage CLI command is executed.
  • The output of most of the cmdlets is returned as text.
  • The output of some of the cmdlets is returned as PowerShell objects. This output can be piped to other PowerShell cmdlets for search.

There are 36 cmdlets available in the current version of the toolkit covering the following –

  • Viewing and managing Common Provision Groups (CPG)
  • Viewing and managing Virtual Volumes
  • Viewing and managing Virtual Volume Sets
  • Viewing and managing Hosts
  • Viewing and managing Host Sets
  • Viewing and managing Virtual Logical Unit Number (vLUN)
  • Viewing and managing Physical copies
  • Viewing and managing Virtual copies (Snapshots)
  • Viewing and managing Ports
  • Viewing and managing Tasks

While the cmdlets don’t cover every function of the array we do have a good starting set which I am sure HP will expand in future releases.

 

Installation

Installation is fairly simple, obviously we first need to download a copy of the PowerShell toolkit from the HP website using the link at the top of this article.

Next we need to extract the zip file and then decide on whether we want the PowerShell modules to be available to just the currently logged on user or all users of the system.

Current User – Copy the folder ‘HP3PARPSToolkit’ to –

%USERPROFILE%\Documents\WindowsPowerShell\Modules\

All Users – Copy the folder ‘HP3PARPSToolkit’ to –

%SYSTEMROOT%\system32\WindowsPowerShell\v1.0\Modules\

 

To connect to the 3PAR arrays using Secure Shell (SSH) we need the Putty tool Plink.exe. This can be downloaded from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Once downloaded we need to copy Plink.exe to a folder at the root of C:\

Note – You can create a folder and save Plink.exe to anywhere on your machine, this path is the default location I will use for the article. When we connect our PowerShell console to the 3PAR we define the location of Plink.exe so feel free to save it somewhere else if you prefer.

Finally we need to open a PowerShell console and import the new 3PAR toolkit modules. To do this we use the Import-Module cmdlet.

PS C:\> Import-Module HP3PARPSToolkit

If required, log files can be found at the following locations (dependent on install) –

%USERPROFILE%\Documents\WindowsPowerShell\Modules\Logs\

OR

%SYSTEMROOT%\system32\WindowsPowerShell\v1.0\Modules\Logs\

 

3PAR PowerShell Cmdlets

We are finally in a position to start using some of the new 3PAR PowerShell cmdlets!

First off let me show you how to get a listing of all the available cmdlets, for this we use Get-3parCmdList –

PS C:\> Get-3parCmdList

Name                              Category  Module                    Synopsis                                                                 
----                              --------  ------                    --------                                                                 
Get-3parCmdList                   Function  HP3PARPSToolkit           Get list of  All HP3PAR PowerShell cmdlets                               
Get-3parCPG                       Function  HP3PARPSToolkit           Get list of common provisioning groups (CPGs) in the system.             
Get-3parFCPORTS                   Function  HP3PARPSToolkit           Query 3PAR to get FC ports                                               
Get-3parFCPortsToCSV              Function  HP3PARPSToolkit           Query 3PAR to get FC ports                                               
Get-3parHost                      Function  HP3PARPSToolkit           Lists hosts                                                              
Get-3parHostPorts                 Function  HP3PARPSToolkit           Query 3PAR to get all ports including targets, disks, and RCIP ports.    
Get-3parHostSet                   Function  HP3PARPSToolkit           Get list of  host set(s) information                                     
Get-3parTask                      Function  HP3PARPSToolkit           Displays information about tasks.                                        
Get-3parVersion                   Function  HP3PARPSToolkit           Get list of  HP 3PAR Storage system software version information         
Get-3parVLUN                      Function  HP3PARPSToolkit           Get list of LUNs that are exported/ presented to hosts                   
Get-3parVV                        Function  HP3PARPSToolkit           Get list of virtual volumes per Domain and CPG                           
Get-3parVVList                    Function  HP3PARPSToolkit           Get list of virtual volumes                                              
Get-3parVVSet                     Function  HP3PARPSToolkit           Get list of Virtual Volume(VV) sets defined on the storage system and ...
New-3parCPG                       Function  HP3PARPSToolkit           Creates a new CPG                                                        
New-3parGroupSnapVolume           Function  HP3PARPSToolkit           creates consistent group snapshots                                       
New-3parGroupVVCopy               Function  HP3PARPSToolkit           Creates consistent group physical copies of a list of virtualvolumes.    
New-3parHost                      Function  HP3PARPSToolkit           Creates a new host.                                                      
New-3parHostSet                   Function  HP3PARPSToolkit           Creates a new host set.                                                  
New-3parSnapVolume                Function  HP3PARPSToolkit           creates a point-in-time (snapshot) copy of a virtual volume.             
New-3parVLUN                      Function  HP3PARPSToolkit           Creates a new vLUN and presents it to host                               
New-3parVV                        Function  HP3PARPSToolkit           Creates a vitual volume.                                                 
New-3parVVCopy                    Function  HP3PARPSToolkit           Creates a full physical copy of a Virtual Volume (VV) or a read/write ...
New-3parVVSet                     Function  HP3PARPSToolkit           Creates a new VolumeSet                                                  
Push-3parGroupSnapVolume          Function  HP3PARPSToolkit           Copies the differences of snapshots back to their base volumes.          
Push-3parSnapVolume               Function  HP3PARPSToolkit           This command copies the differences of a snapshot back to its base vol...
Push-3parVVCopy                   Function  HP3PARPSToolkit           Promotes a physical copy back to a regular base volume                   
Remove-3parCPG                    Function  HP3PARPSToolkit           Removes a CommonProvisionGroup(CPG)                                      
Remove-3parHost                   Function  HP3PARPSToolkit           Removes a host.                                                          
Remove-3parHostSet                Function  HP3PARPSToolkit           Remove a host set or remove hosts from an existing set                   
Remove-3parVLUN                   Function  HP3PARPSToolkit           Unpresent virtual volumes                                                
Remove-3parVV                     Function  HP3PARPSToolkit           Delete virtual volumes                                                   
Remove-3parVVSet                  Function  HP3PARPSToolkit           Remove a Virtual Volume set or remove VVs from an existing set           
Set-3parFCPORTS                   Function  HP3PARPSToolkit           Configure 3PAR FC ports                                                  
Set-3parHost                      Function  HP3PARPSToolkit           Add WWN or iSCSI name to an existing host.                               
Set-3parHostPorts                 Function  HP3PARPSToolkit           Configure settings of the 3PAR array.                                    
Set-3parVV                        Function  HP3PARPSToolkit           Updates a snapshot Virtual Volume (VV) with a new snapshot.

 

If you want to view help information for a cmdlet you do this in exactly the same way as any other PowerShell session with the Get-Help cmdlet –

PS C:\> get-help Get-3parVV

This gives us a short help summary however we can get a more extensive breakdown by adding the –Full switch to the command –

PS C:\> get-help Get-3parVV –full

 

Connect PowerShell Toolkit to 3PAR

Now that we know how to find a list of cmdlets and view help information it’s time to actually connect to a 3PAR array. To do this we will leverage the New-SANConnection cmdlet. I have provided the default ‘root’ account username and password in this example.

PS C:\> New-SANConnection -SANUserName "3paradm" -SANPassword "3pardata" -SANIPAddress "10.1.1.1" -SSHDir "C:\Plink"

If this is your first time connecting you will receive an error message like this –

Plink.exe : The server's host key is not cached in the registry.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\HP3PARPSToolkit\VS-Functions.psm1:295 char:2
& $Plink  -l $username -pw $password $DeviceIPAddress $cmd
+ CategoryInfo: NotSpecified: (The server's ho...e registry. You:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

You have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 68:a6:c9:60:a1:cb:12:e2:76:1a:ee:47:b0:8b:f9:ee
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n)

At this point we need to confirm we wish to connect and add the array fingerprint by pressing ‘y’. I’ve found the PowerShell ISE console doesn’t always pass this through correctly. I’d suggest using a standard PowerShell console instead, once the key is cached you can use the ISE without being prompted. Alternately you could just launch Plink.exe and connect to the array once and accept the key so it is added to the Plink.exe cache.

PS C:\> New-SANConnection -SANUserName "3paradm" -SANPassword "3pardata" -SANIPAddress "10.1.1.1" -SSHDir "C:\Plink"

AdminName                           Password                            IPAddress                           SSHDir                             
---------                           --------                            ---------                           ------                             
3paradm                             System.Security.SecureString        10.1..1                        C:\Plink

Now that we have connected we can test a few of the cmdlets. Let’s start by running Get-3parVersion –

PS C:\> Get-3parVersion


ReleaseVersionName : 3.2.1(MU2)
Patches            : P07P10
CliServer          : 3.2.1(P11)
CliClient          : 3.2.1
SystemManager      : 3.2.1(P11)
Kernel             : 3.2.1(MU2)
TPDKernelCode      : 3.2.1(P11)

Now let us try another cmdlet, this time Get-3parVV –

PS C:\> Get-3parVV


Name        : bsa_fileservices_vv
CPG         : NL_r1
Adm(MB)     : 9472
Snp(MB)     : 16256
Usr(MB)     : 13700352
New_Adm(MB) : 0
New_Snp(MB) : 0
New_Usr(MB) : 0

[Additional output removed]

If we wanted to create a new virtual volume the cmdlet New-3parVV would be used –

PS C:\> New-3parVV -vvName "PowerShell_vv" -Size "100g" -CPGName "FC_r5" –tpvv

We can of course pipe output from a cmdlet. Below is an example where I take the output from Get-3parVV and pipe it through a ‘where’ statement to help me find volumes with a name similar to ‘bsa_esxi’. You will notice that the volumes show up multiple times, in this case it is because they are part of an Autonomic Optimisation (AO) configuration and therefore span multiple CPGs (SSD, SAS, NLSAS).

PS C:\> Get-3parVV | where {$_.Name -ilike "bsa_esxi*"}

Name        : bsa_esxi_vv09
CPG         : AO_SSD_r5
Adm(MB)     : 768
Snp(MB)     : 0
Usr(MB)     : 75904
New_Adm(MB) : 0
New_Snp(MB) : 0
New_Usr(MB) : 0

Name        : bsa_esxi_vv09
CPG         : AO_FC_r5
Adm(MB)     : 32
Snp(MB)     : 0
Usr(MB)     : 66560
New_Adm(MB) : 0
New_Snp(MB) : 0
New_Usr(MB) : 0

Name        : bsa_esxi_vv09
CPG         : AO_NL_r1
Adm(MB)     : 224
Snp(MB)     : 0
Usr(MB)     : 274432
New_Adm(MB) : 0
New_Snp(MB) : 0
New_Usr(MB) : 0

Name        : bsa_esxi_vv10
CPG         : AO_SSD_r5
Adm(MB)     : 736
Snp(MB)     : 0
Usr(MB)     : 194176
New_Adm(MB) : 0
New_Snp(MB) : 0
New_Usr(MB) : 0

Name        : bsa_esxi_vv10
CPG         : AO_FC_r5
Adm(MB)     : 0
Snp(MB)     : 0
Usr(MB)     : 109952
New_Adm(MB) : 0
New_Snp(MB) : 0
New_Usr(MB) : 0

Name        : bsa_esxi_vv10
CPG         : AO_NL_r1
Adm(MB)     : 160
Snp(MB)     : 0
Usr(MB)     : 336256
New_Adm(MB) : 0
New_Snp(MB) : 0
New_Usr(MB) : 0

[additional output removed]

 

I’m only scratching the surface in terms of the cmdlets available and the clever ways they could be used – I’d love to hear what other people come up with, if you have some cool PowerShell scripts you want to share with the community please comment or contact me directly on Twitter.

Leave a Reply

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