How-To: Manage Hosts and Host Connections with SDK v2
This article is for the PowerShell SDK version 2.
Creating a Host
The New-Pfa2Host
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 SDKv2-host with the specified WWNs on an array previously connected to and set in the $FlashArray
variable.
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-Pfa2Host -Array $FlashArray -Wwns $wwn -Name SDKv2-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 SDKv2-IQNS-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-Pfa2Host -Array $FlashArray -Name 'SDKv2-IQNS-host' -Iqns $iqn
The view from the Web management interface shows the host and assigned IQNs.
Connecting and Removing a Volume to a 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-Pfa2Connection
cmdlet. The below example first uses the Get-Pfa2Volume
cmdlet with a Where-Object
clause to retrieve the previously created sample volumes.
PS C:\> Get-Pfa2Volume -Array $FlashArray | Where-Object { $_.name -like 'SDK*' } | Format-Table -AutoSize Id Name ConnectionCount Created Destroyed HostEncryptionKeyStatus Provisioned Qos -- ---- --------------- ------- --------- ----------------------- ----------- --- 2245a634-7bd9-55c8-d22a-0e4e17bbe9f7 SDK2-sample-3 0 8/7/2020 3:07:24 PM False none 2147483648 class Qos {… d73e3c73-c0d4-6982-c377-d70f0e813b63 SDK2-sample-2 0 8/7/2020 3:07:24 PM False none 2147483648 class Qos {… d59bbc70-ca3a-4c61-7c6e-b5ac0ba54ea4 SDK2-sample-1 0 8/7/2020 3:07:24 PM False none 2147483648 class Qos {… PS C:\> New-Pfa2Connection -Array $FlashArray -VolumeNames 'SDKv2-Sample-1' -HostNames 'SDKv2-host'
The view from the Web management interface shows the SDKv2-Sample-1 volume connect to the SDKv2-host.
To remove a volume that is connected to a host, use the Remove-Pfa2HostVolumeConnection
cmdlet.
PS C:\> Remove-Pfa2Connection -Array $FlashArray -VolumeNames 'SDKv2-Sample-1' -HostNames 'SDKv2-host'
Creating a Host Group and Adding Hosts
The New-Pfa2HostGroup
cmdlet is used to create a new Host Group.
PS C:\> New-Pfa2HostGroup -Array $FlashArray -Name 'SDKv2-HostGroup'
The view from the Web management interface shows the new SDK-Sample-HostGroup.
Adding and Removing a Host within a Host Group
To add a Host(s) to an existing Host Group, use the New-Pfa2HostHostGroup
cmdlet.
PS C:\> $hosts = @('SDKv2-host','SDKv2-IQNS-host') PS C:\> $hosts SDKv2-host SDKv2-IQNS-host PS C:\> New-Pfa2HostHostGroup -Array $FlashArray -GroupNames 'SDKv2-HostGroup' -MemberNames $hosts
The view from the Web management interface shows the new SDKv2-HostGroup and added Hosts.
To remove a Host(s) from a Host Group, use the Remove-Pfa2Host
cmdlet.
PS C:\> Remove-Pfa2Host -Array $FlashArray -HostsToRemove $hosts -Name 'SDKv2-HostGroup'
Connecting and Removing a Volume in a Host Group
Connecting a volume to a host group allows all of the hosts within the host group to see the volume. A typical use case for this is creating a Clustered Shared Volume (CSV) for high-availability for all Windows Server Failover Cluster nodes. Use the New-Pfa2Connection
cmdlet.
PS C:\> New-Pfa2Connection -Array $FlashArray -VolumeNames 'SDKv2-Sample-2' -HostGroupNames 'SDKv2-HostGroup'
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-Pfa2Connection
cmdlet.
PS C:\> Remove-Pfa2Connection -Array $FlashArray -VolumeNames 'SDKv2-Sample-2' -HostGroupNames 'SDKv2-HostGroup'