Volume matching via the API in Purity 5.0

In this post you’ll learn how to non-disruptively migrate a volume from one array to another in Purity 5.0.


This blog was published in 2018. See the latest Purity version.

If you’ve updated to Purity 5.0, you may run into issues with volume matching with ActiveCluster. This blog explains how to match volumes for VMFS.

Traditionally how this was done, at least from a VMware perspective was via the NAA (network address authority). You take this number, which is how ESXi uniquely addresses a volume and slice it up to find the array serial and the volume serial. By matching the section with a particular array serial, you have identified what array owns it. Then you can make the calls to that array.

Details on how this worked are beyond the scope of this post, but you can see this here:

VMFS Snapshots and the FlashArray Part IV: How to correlate a VMFS to a FlashArray volume

Anyways, Purity 5.0 can throw a wrench into the gears of this. Specifically ActiveCluster. ActiveCluster allows a volume to exist on two FlashArrays at once. The procedure is, you create a group called a pod, put one or more volumes in it, then stretch it to another array. This synchronizes the data to the other side and then offers up those volumes from each array simultaneously.

You can then unstretch the pod and remove the first array. This effectively non-disruptively migrates a volume from one array to another. This also means the serial number of that volume will no longer match its hosting array. So this breaks the original paradigm.

So what is the best way to match?

Well for VVols, this is a non-issue, VMware tells you immediately what array hosts that VVol. But that is a blog post for another day.

So how about VMFS?

\Well the longer option is get all of the volumes from each array an iterate until you hit a match. This is a lot more work then necessary. Why not just ask the array if it has that volume?

This can be done with REST filters. Let me show you in Postman:

So if I pull all volumes with GET and https://10.21.202.52/api/1.13/volume

Purity 5.0

I get all of the volumes on that array. Yuck. This could be 1000s! So then I have to iterate or do an indexOf or whatever.

The FlashArray, in the CLI and the REST supports filtering. You can specify a property and a value and have the array middleware parse its response for you.

So add the filter ?filter=serial=’4BFAB20D4B694DF70001C268′ to the end of the call. The serial being the serial of your volume. It is case insensitive by the way.

This returns just one volume instead of many. If the response is null, then you know that array does not host that volume.

Let’s look at this with PowerShell and then vRealize Orchestrator.

PowerShell/PowerCLI

This can be done in PowerShell fairly easily. You can of course use invoke-webrequest if you want to do it manually, or you can use our PowerShellSDK. Our PowerShell SDK does not directly support filtering yet, but you can use the cmdlet new-pfaCLICommand to call the operation. This cmdlet basically makes an SSH session and runs the input command.

Here is a quick and dirty example:


Takes in a few FlashArray IPs/FQDNs and credentials and then a vCenter. Give it a datastore name and it writes out the FlashArray that owns it.

The pfa-CLIcommand requires the IP or FQDN, credentials and then the command itself:

Note I have to use escape characters (`) before the quotes because the whole thing needs to be passed in via quotes.

This feels a bit clunky and it is. For PowerShell I prefer just pulling all of the volumes with the PowerShellSDK directly and having PowerShell parse it:

You may or may not prefer that method.

vRealize Orchestrator

Using our vRO plugin, the filtering process is much slicker. For two major reasons:

  1. It doesnt create an SSH session, it makes a REST call, so it is not separate authentication.
  2. The response is in JSON which is much easier to parse than the SSH response in PowerShell.

There are a million ways to find out what array holds a volume in vRO. A nice benefit of vRO is that the inventory of the registered FlashArrays is always synced with vRO, so you can look through the inventory just like you would VMs or datastores:

There are of course built-in workflows to do this work for you, but the purpose of this post is really to show how you can do filtering. So how do we do it in vRO?

Well it is pretty simply. There is an action that allows you to make REST calls in the plugin.

So let’s say we want a workflow to take in a datastore and tell me what FlashArray it is on. So the input is a datastore and the output is a FlashArray object:

So in this case, pull in all of the FlashArrays and then iterate through them and make the REST GET call:

I pass in the URI which in full is:

But I only need the part after the API version, so it really it is:

Once again will pull in the serial from the datastore and then pass it to the array to filter.

Conclusion

Is filtering the best way to go? Not always, you might prefer to pull in all of the volumes and iterate yourself. It depends on what you are trying to do and with what tool.

The real point is, because a serial number of a volume is no longer tied to a FlashArray, do not assume it is on the FlashArray it was originally created on. There is no real direct correlation any more. The serial prefix only tells you what array it was originally created on, not necessarily where it is today.

So in the end, update your scripts with this logic. Whether you use REST filtering, or you use scripting tool logic, that is up to you.