Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /home/content/p3pnexwpnas08_data02/60/2596660/html/wp-includes/wp-db.php on line 1877

Warning: mysqli_query(): (HY000/1030): Got error 28 from storage engine in /home/content/p3pnexwpnas08_data02/60/2596660/html/wp-includes/wp-db.php on line 1877
class="post-2117 post type-post status-publish format-standard hentry">

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

This is part 4 of this 7 part series.

The series being:

  1. Mounting an unresolved VMFS
  2. Why not force mount?
  3. Why might a VMFS resignature operation fail?
  4. How to correlate a VMFS and a FlashArray volume
  5. How to snapshot a VMFS on the FlashArray
  6. How to mount a VMFS FlashArray snapshot
  7. Restoring a single VM from a FlashArray snapshot

Now that we have gone over the basics of VMFS snapshot mounting, how do we figure out what FlashArray volume hosts a particular VMFS? There are a variety of ways to do this–it depends on what you are trying to do. I will describe how to do it using a few different sources. All you need is the VMFS volume name. These will either get you the NAA or the FlashArray volume serial number or just do the correlation for you.

To immediately correlate:

  1. Pure Storage Web Client Plugin (does it all)

To find the Network Address Authority from ESXi:

  1. Web Client GUI
  2. ESXi CLI
  3. VMware PowerCLI

To find a FlashArray volume serial number:

  1. FlashArray GUI
  2. FlashArray CLI
  3. Pure Storage PowerShell SDK

Feel free to mix and match. I will have a full example at the end using PowerCLI and the Pure Storage PowerShell SDK.

Before I go into the methodology, let’s discuss conceptually how this is figured out.

VMFS to FlashArray Volume Correlation

Regardless on the method you use to figure out this correlation, the same workflow is used  to do it. What changes is what you way you choose to get the information.

Let me also be clear, we are technically correlating a SCSI device that hosts a VMFS to a FlashArray volume, not really directly VMFS to the FlashArray volume. Hopefully this is a 1:1:1 relationship–people should really never use multiple SCSI devices to host a VMFS. While possible, this is generally a bad idea.

Please note that this post is specific to the Pure Storage FlashArray, so while the general concept is probably valid for other arrays specifics of serial number creation might vary.

Every FlashArray volume comes with a serial number (and so does every snapshot). This provides a way to uniquely identify every volume. I will go into detail about methods of getting these values later.

There are three values (hexadecimal) that we are concerned about here:

  1. FlashArray array ID
  2. FlashArray volume serial number
  3. Network Address Authority ID of a SCSI volume as seen by VMware

An example FlashArray array ID is 73e940225a2a52bb222bd4ced012bc6f. This is a unique identifier that describes the array.

A volume from that FlashArray has a serial number of 73E940225A2A52BB000189EB. You might notice some similarities. Let’s line them up:

73e940225a2a52bb222bd4ced012bc6f (Array ID)

73e940225a2a52bb000189eb (Volume Serial)

The first 16 characters in the volume serial number indicate what FlashArray that volume is from. The last 8 are unique to that volume on that FlashArray, which are then used to identify the specific volume.

Now let’s take a look at the NAA in ESXi for that same volume.

624a937073e940225a2a52bb000189eb

Once again some similarities. But some new stuff too. The “6” is part of a designator in the NAA Registered Extended format. This will be common across array vendors. The next few digits is Pure Storage’s assigned IEEE OUI number (24a9370). The OUI technically doesn’t include the trailing zero, but for these purposes it is always there. The next 24 characters is the volume serial number (16 from the array and 8 from the unique volume).

                73e940225a2a52bb222bd4ced012bc6f (Array ID)

                73e940225a2a52bb000189eb (Volume Serial)

624a937073e940225a2a52bb000189eb (NAA)

So using this information you can find out:

  • If a SCSI device seen by ESXi is a Pure Storage device
  • What FlashArray it belongs to
  • What volume on that FlashArray it is

Pure Storage vSphere Web Client Plugin

This is the simplest option. Immediately find the information on a VMFS from a FlashArray perspective. To know how to install and configure the Web Client Plugin, see information on that here.

If you have a datastore you want to know what array it is on and what volume, just click on the datastore object and then the Pure Storage tab. If the tab is not there it is either not a Pure Storage volume or the FlashArray it is on is not configured in the plugin.

webclientplugin

Finding the Network Address Authority

Okay, let’s walk through the options for finding the NAA. This is not exhaustive of course, but the most common options.

vSphere Web Client

Some customers for one reason or another do not want to use the plugin. Some can’t like in the case where the FlashArray management network is totally separate from the VMware network. Anyway, what can they do if they just want to use the GUI?

Well in the vSphere Web Client, just navigate to the VMFS datastore object in the inventory and choose the “Manage” tab. Click on the “Device Backing” panel.

devicebackingwebclient

You will see the NAA for the underlying device listed there.

ESXi CLI

If you want to find this information in the CLI this is pretty straight forward. SSH into the ESXi host and run the following command.

esxcli storage vmfs extent list

estentlist

This will lists all of the VMFS volumes on that host and their NAA. This can be parsed to find what you need.

VMware PowerCLI

My favorite option! Love me some PowerCLI. Finding a NAA in PowerCLI can be achieved in a variety of ways. First like always, you need to connect to a vCenter and get your host object.

connecvi

Now you want to get your datastore information by passing it the VMFS name. My VMFS name is FlashArrayVMFS. I am storing it in a PowerShell object called $datastore.

$datastore = get-datastore FlashArrayVMFS

From here, I have to options. Either use get-scsilun or pull it from the extension data. I prefer extension data for two reasons; it literally returns the data faster and it is a simpler command. To use get-scsilun, you pass the $datastore object to it and store it in a new object, which I called $lun.

$datastore | get-scsilun |select-object -last 1

I added “select-object -unique” because when there are multiple hosts in the vCenter it will return more than one listing of the NAA (they will all be the same) so I tell PowerShell to only return one listing if they are all the same.

The NAA is now just stored in this as the CanonicalName. So to grab it just run:

$lun.CanonicalName

See below:

getscsilun

 

Using the extension data is easier. Once you have the $datastore object, just run the following. It will return the NAA:

$datastore.ExtensionData.Info.Vmfs.Extent.DiskName

No need to use the get-scsilun or $lun stuff.

extentsion

Faster too:

timecomparison

0.0005941 seconds as compared to 1.4370596 seconds. 2,418 times faster! Woohoo!

Get the FlashArray array ID and Volume Serial Number

Now that we have the NAA from ESXi, time to get the array and volume information from the FlashArray.

Using the FlashArray GUI

You can’t directly get the FlashArray array ID from the FlashArray GUI, but you can indirectly. Which gives you all you need to know. Remember that the first 16 digits of any volume serial number is the array ID (or enough of it that is can be considered unique). So to find that and the right volume go to the “Storage” tab and click on the “Volumes” list.

guivolumes

Then click on any random volume and then its details page. Look at the serial, if the prefix matches, it is the right FlashArray. Then iterate through the volumes until you find the right one.

serial

This is fine if you have a few volumes or a few FlashArrays, but not if you have 1000s of volumes. Time for something better.

Using the FlashArray CLI

The FlashArray CLI can be accessed by SSHing into the FlashArray.

To find the array ID just run:

purearray list

To find a list of all of the volumes, run:

purevol list

purecli

Better, but we can do better with scripting. Let’s do use PowerShell.

Using the Pure Storage PowerShell SDK

The Pure Storage PowerShell SDK is a PS module that has custom commands for the FlashArray that you can use to manage/configure your arrays. The SDK communicates to the FlashArray over our REST API without requiring you to understand REST. Just PowerShell basics.

Like PowerCLI, we need to authenticate to your FlashArray first. So I would use the following, this will prompt the user for the FlashArray IP/FQDN and user name and password (the password will be a secure string):

$flasharray = Read-Host "Enter FlashArray FQDN or IP"
$pureuser = Read-Host "Enter FlashArray user name"
$pureuserpwd = Read-Host "Enter FlashArray password" -AsSecureString
$Creds = New-Object System.Management.Automation.PSCredential ($pureuser, $pureuserpwd)
$EndPoint = New-PfaArray -EndPoint $flasharray -Credentials $Creds -IgnoreCertificateError

Using the Pure PowerShell SDK cmd new-pfaArray we can authenticate with the FlashArray.

Now we need to get all of the volumes from the FlashArray with their serial numbers and compare your NAA to find a match. So I will store the NAA in the object $lun by asking the user for it:

$lun = Read-Host "Enter VMFS NAA"

Then get all of the volumes with get-pfavolumes:

$purevolumes = Get-PfaVolumes -Array $EndPoint

Since serial numbers are hex, letters will likely be present, so we need to worry about case. We can either do a case insensitive comparison or just make sure they are both upper case. The REST response is upper, so I will just make the input forced into upper case.

$volserial = ($lun.ToUpper()).substring(12)

This line also cuts the NAA so it only includes the last digits that will match the volume specifically.

Then we look for a match:

$purevol = $purevolumes | where-object { $_.serial -eq $volserial }

If anything matches it will be stored in the $purevol object. We can return the name if it does:

write-host (“The VMFS volume is on the FlashArray volume named ” + $purevol.name)

Perfect. If I put this together and add some checking to see if it is even a Pure Storage volume it will look like this:

$flasharray = Read-Host "Enter FlashArray FQDN or IP"
$pureuser = Read-Host "Enter FlashArray user name"
$pureuserpwd = Read-Host "Enter FlashArray password" -AsSecureString
$lun = Read-Host "Enter VMFS NAA"
$Creds = New-Object System.Management.Automation.PSCredential ($pureuser, $pureuserpwd)
$EndPoint = New-PfaArray -EndPoint $flasharray -Credentials $Creds -IgnoreCertificateError
$purevolumes = Get-PfaVolumes -Array $EndPoint
if ($lun -like 'naa.624a9370*')
{
 $volserial = ($lun.ToUpper()).substring(12)
 $purevol = $purevolumes | where-object { $_.serial -eq $volserial }
 write-host ("The VMFS volume is on the FlashArray volume named " + $purevol.name)
}
else
{
 write-host 'This datastore is NOT a Pure Storage Volume.'
}
foreach ($flasharray in $endpoint)
{
 Disconnect-PfaArray -Array $flasharray
}

singlefa

This works for one FlashArray, but how about many? You can find a script that will look across many FlashArrays at the link below on my GitHub. Also, instead of taking in a NAA, it includes vSphere PowerCLI, so you supply the VMFS name and it does the rest of the work!

scriptdone

https://github.com/codyhosterman/powercli/blob/master/findFlashArrayVolumeNamefromVMFSName.ps1

One thought on “VMFS Snapshots and the FlashArray Part IV: How to correlate a VMFS to a FlashArray volume”

Leave a Reply

Your email address will not be published. Required fields are marked *