This article is for the PowerShell SDK version 1.
In this section we will cover:
Create a Host
The
New-PfaHost cmdlet is used to create a new Host on the FlashArray. Before using this cmdlet, have either the IQNs (iSCSI) or WWNs (Fibre Channel) names available. The below sample creates a new host named SDK-Sample-Host with the specified WWNs.
PS C:\> $wwn = @('10:00:00:00:00:00:11:11','10:00:00:00:00:00:12:12')
PS C:\> $wwn
10:00:00:00:00:00:11:11
10:00:00:00:00:00:12:12
PS C:\> New-PfaHost -Array $FlashArray -WwnList $wwn -Name SDK-Sample-Host
iqn wwn name
--- --- ----
{} {1000000000001111, 1000000000001212} SDK-Sample-Host
The view from the Web management interface shows the host and assigned WWNs.
WWNs or IQNs can be specified using a PowerShell array, Eg.
$wwn = @('##','##') or
$iqn = @('##','##'). This is an easier method to use than entering directly as a parameter entry.
Below is an example of creating a new host named SDK-IQNSample-Host with assigned IQNs.
PS C:\> $iqn = @('iqn.1998-01.com.sample1.iscsi','iqn.1998-01.com.sample2.iscsi')
PS C:\> $iqn
iqn.1998-01.com.sample1.iscsi
iqn.1998-01.com.sample2.iscsi
PS C:\> New-PfaHost -Array $FlashArray -Name 'SDK-IQNSample-Host' -IqnList $iqn
iqn wwn name
--- --- ----
{iqn.1998-01.com.sample1.iscsi, iqn.1998-01.com.sample2.iscsi} {} SDK-IQNSample-Host
The view from the Web management interface shows the host and assigned IQNs.
Connect Volume to Host
Using the sample hosts created for Fibre Channel and iSCSI above, volumes can now be connected. To connect a volume to a host, use
New-PfaHostVolumeConnection cmdlet. The below example first uses the
Get-PfaVolumes cmdlet with a
Where-Object clause to retrieve the previously created sample volumes.
PS C:\> Get-PfaVolumes -Array $FlashArray | Where-Object { $_.name -like 'SDK*' } | Format-Table -AutoSize
source serial created name size
------ ------ ------- ---- ----
95DAA3D006E43D8F0004B467 2016-11-01T21:30:47Z SDK-Sample 536870912000
95DAA3D006E43D8F0004B468 2016-11-01T21:41:16Z SDK-Sample-1 262144000
95DAA3D006E43D8F0004B469 2016-11-01T21:41:17Z SDK-Sample-2 262144000
95DAA3D006E43D8F0004B46A 2016-11-01T21:41:17Z SDK-Sample-3 262144000
95DAA3D006E43D8F0004B46B 2016-11-01T21:41:17Z SDK-Sample-4 262144000
95DAA3D006E43D8F0004B46C 2016-11-01T21:41:17Z SDK-Rename-5 262144000
95DAA3D006E43D8F0004B46D 2016-11-01T21:41:17Z SDK-Sample-6 262144000
95DAA3D006E43D8F0004B46E 2016-11-01T21:41:17Z SDK-Sample-7 262144000
95DAA3D006E43D8F0004B46F 2016-11-01T21:41:17Z SDK-Sample-8 262144000
95DAA3D006E43D8F0004B470 2016-11-01T21:41:17Z SDK-Sample-9 262144000
95DAA3D006E43D8F0004B471 2016-11-01T21:41:18Z SDK-Sample-10 262144000
PS C:\> New-PfaHostVolumeConnection -Array $FlashArray -VolumeName 'SDK-Sample-1' -HostName 'SDK-Sample-Host'
vol name lun
--- ---- ---
SDK-Sample-1 SDK-Sample-Host 1
The view from the Web management interface shows the SDK-Sample1 volume connect to the SDK-Sample-Host (Fibre Channel).
Below is an example of connecting a volume to the SDK-IQNSample-Host (iSCSI).
PS C:\> New-PfaHostVolumeConnection -Array $FlashArray -VolumeName 'SDK-Sample-10' -HostName 'SDK-IQNSample-Host'
vol name lun
--- ---- ---
SDK-Sample-10 SDK-IQNSample-Host 1
The view from the Web management interface shows the host and assigned IQNs.
The view from the Web management interface shows the SDK-Sample10 volume connect to the SDK-IQNSample-Host (iSCSI).
To add additional WWNs or IQNs to a host, use the
Add-PfaHostWwns or
Add-PfaHostIqns. To remove a volume that is connected to a host, use the
Remove-PfaHostVolumeConnection cmdlet.
PS C:\> Remove-PfaHostVolumeConnection -Array $FlashArray -VolumeName 'SDK-Sample-1' -HostName 'SDK-Sample-Host'
vol name
--- ----
SDK-Sample-1 SDK-Sample-Host
Create a Host Group & Add Hosts
The
New-PfaHostGroup cmdlet is used to create a new Host Group.
PS C:\> New-PfaHostGroup -Array $FlashArray -Name 'SDK-Sample-HostGroup'
hosts name
----- ----
{} SDK-Sample-HostGroup
The view from the Web management interface shows the new SDK-Sample-HostGroup.
Add Host to Host Group
To add a Host(s) to an existing Host Group, use the
Add-PfaHosts cmdlet.
PS C:\> $hosts = @('SDK-Sample-Host','SDK-IQNSample-Host')
PS C:\> $hosts
SDK-Sample-Host
SDK-IQNSample-Host
PS C:\> Add-PfaHosts -Array $FlashArray -Name 'SDK-Sample-HostGroup' -HostsToAdd $hosts
hosts name
----- ----
{SDK-Sample-Host, SDK-IQNSample-Host} SDK-Sample-HostGroup
The view from the Web management interface shows the new SDK-Sample-HostGroup and added Hosts.
To remove a Host(s) from a Host Group, use the
Remove-PfaHosts cmdlet.
PS C:\> Remove-PfaHosts -Array $FlashArray -HostsToRemove $hosts -Name 'SDK-Sample-HostGroup'
hosts name
----- ----
{} SDK-Sample-HostGroup
Connect Volume to Host Group
The final task is to connect a Volume to a Host Group. Connecting a volume to a host group allows all of the hosts within the host group to see the volume. A use case example for this is creating a Clustered Shared Volume (CSV) for high-availability for all Windows Server Failover Cluster nodes. Use the
New-PfaHostGroupVolumeConnection cmdlet.
PS C:\> New-PfaHostGroupVolumeConnection -Array $FlashArray -VolumeName 'SDK-Sample-2' -HostGroupName 'SDK-Sample-HostGr
oup'
vol name lun
--- ---- ---
SDK-Sample-2 SDK-Sample-HostGroup 254
The view from the Web management interface shows the SDK-Sample-2 added to the Host Group.
To remove a connected volume from a host group, use
Remove-PfaHostGroupVolumeConnection cmdlet.
PS C:\> Remove-PfaHostGroupVolumeConnection -Array $FlashArray -VolumeName 'SDK-Sample-2' -HostGroupName 'SDK-Sample-Hos
tGroup'
vol name
--- ----
SDK-Sample-2 SDK-Sample-HostGroup