Advanced

Array Based Replication with PowerCLI 13.1

This blog post explains how to configure Array Based Replication (ABR) with the PowerCLI VMware.Sdk.Srm module. Before diving in, consider reading the blog post, explaining the basic concepts of the VMware.Sdk.Srm module: “Managing SRM and VR with PowerCLI 13.1“. There you can find out more about the module’s connection management, which will not be covered in details here.

Connect Site Recovery Manager with Connect-SrmSdkServer

To connect Site Recover Manager server use the Connect-SrmSdkServer cmdlet:

Create Array Managers for the Array Pair

Before creating the array pair you must create array managers for the local and the remote sites.

Retrieve Storage Replication Adapter for the local Array Manager

For this example we will use NetApp Storage Replication Adapter for ONTAP:

Invoke-SrmGetStorageAdapters returns a list of adapters, matching the specified filters. In our case we filter the available storage adapters by their Name property and expect only one adapter with name matching ‘NetApp’ to be found. Accordingly we will use the first element of the List property of the StorageAdapterDetailsDrResponseList object, returned from Invoke-SrmGetStorageAdapters.

Prepare Connection Parameters for the Storage Replication Adapter

To allow the array manager to communicate with the storage adapter we must prepare connection parameters, which will be used for the connection. Retrieve ConnectionParamGroup object for the local storage adapter:

The output of Invoke-SrmGetStorageAdapterConnectionParams is a ConnectionParamGroupDrResponseList object, which in our case contains a list of one ConnectionParamGroup element. You have to provide values to the connection parameter, available in the $localConnectionParamGroup.ConnectionParams list. The set of parameters, available in the ConnectionParams list is specific for the used storage replication adapter. Here we will provide values for connection parameters, specific for the NetApp storage replication adapter:

Create the local Array Manager

Now when we have all the prerequisites for the array manager, use the ConnectionParamGroup and the storage adapter Id to initialize ArrayManagerSpec object:

Then create the array manger, using the Invoke-SrmCreateArrayManage cmdlet:

Wait for the task to complete and retrieve the array manager. The Result property of the task will contain the Id of the array manager, once the task completes:

Create the remote array manager, using the same approach:

Create Replicated Array Pair

To create the replicated array pair, you have to initialize a ReplicatedArrayPairSpec object:

Besides the ArrayManagerId you have to specify the StorageArrayKey and the PeerStorageArrayKey parameter. The available storage array keys can be found in the StorageArrays property of the local and the remote array managers.

Use the Invoke-SrmCreateReplicatedArrayPair cmdlet to create the replicated array pair:

Wait for the task to complete and retrieve the replicated array pair. The Result property of the task will contain the Id of the replicated array pair, once the task completes:

Create Protected Group and Recovery Plan for the Replicated Array Pair

Use the Invoke-SrmDiscoverStorageDevices cmdlet to discover the storage devices of the replicated array pair. Wait for the task to complete before proceeding to the next step:

Retrieve the storage devices from the replicated array pair:

Initialize an AbrProtectionGroupSpec object. In our setup we created replicated array pair with single storage device, containing one datastore. We will create protection group for this datastore:

Then initialize ProtectionGroupCreateSpec object. For the ReplicationType parameter specify ABR:

Use Invoke-SrmCreateGroup to create the ABR protection group. Wait for the task to complete and retrieve the protection group:

Finally, you can create recovery plan for the protection group, we have just crated. To do this, Initialize RecoveryPlanCreateSpec object:

Create recovery plan with the Invoke-SrmCreatePlan cmdlet and wait for the task to complete:

Disconnect the SRM server connection

After you have finished interacting with the SRM server, close the connection, using the Disconnect-SrmSdkServer cmdlet.

Conclusion

VMware.Sdk.Srm PowerCLI module enables the access to the Site Recovery Manager Rest API through PowerShell cmdlets. In this article we covered the end to end scenario of configuring array based replication and creation of protection group and recovery plan, based on this replication flavor. If you’re interested in using host based replication, refer to the “Managing SRM and VR with PowerCLI 13.1” blog post.