Mounting a VVol Datastore with PowerCLI

I’ve been making a lot of updates to my PowerShell module around VVols recently and this was the last “table stakes” cmdlet I wanted to add. There are certainly more to come, but now we definitely have the basics. In release of the PowerShell module I added a cmdlet called Mount-PfaVvolDatastore.

As of today we support a single VVol datastore–though we are working on adding support for more than one.

This cmdlet behaves as the following:

  • Checks to see if a protocol endpoint for the specified array is presented to the cluster. If not it presents one. You can specify a specific one if you so choose, but there is not much of a use case for that today (there will be in the future)
  • Rescans the cluster and makes sure the PE is seen. If it is not, the process will fail. Likely a network issue (iSCSI not configured, zoning etc)
  • Mounts the VVol datastore to the cluster
  • Returns the datastore

You have a few options on how to specify which VVol datastore (as of writing this is analogous to a FlashArray since it is 1:1):

  • Pass in a VVol datastore. Basically this means, hey mount this same VVol datastore to this other cluster.
  • A FlashArray PowerShell connection. I will decipher the VVol datastore and mount it.
  • A VASA Storage array. This is the representation of a storage array in the VMware context (see Get-VasaStorageArray).

If the datastore has never been mounted, you need to specify a name as well. If it is already mounted somewhere I will just find the name for you.

You do NOT need to pass in a FlashArray connection if the PE has already been presented–this is only required if the PE is not already presented to the cluster. So if you don’t have access to the FlashArray, ask that it be presented to the cluster. Whether a PE is presented to a cluster is how the array allows or disallows VVol access to that cluster. Or pass in the connection and I will do it.

Example 1

Let’s walk through a common example. This is a new VVol datastore and the PE has not been presented. So this means I need to pass in three things, a cluster, a FlashArray connection, and a datastore name.

So I connect to vCenter and create my FlashArray connection:

connect-viserver -Server  <vCenter FQDN>

$flasharray = new-pfaConnection -endpoint <FlashArray FQDN> -credentials (get-credential) -ignoreCertificateError -nonDefaultArray

As you can see the VVol datastore is not currently mounted:

And the PE is not connected:

Let’s now run Mount-PfaVvolDatastore.

Mount-PfaVvolDatastore -flasharray $flasharray -cluster (get-cluster <cluster name>) -datastoreName <datastore name>

We can see that the PE is now connected:

And the datastore has been mounted to the cluster:

Example 2

What if you don’t have access to the array? Well in this case, let’s presume the protocol endpoint is already presented to the cluster. Yay! We’ve been enabled for VVols!

This image has an empty alt attribute; its file name is image-32.png

So now I only need to mount the VVol datastore. If the VVol has never been mounted before, and I cannot create a PowerShell array connection (I am not authorized in this situation), how do I say what datastore I want to mount? Well this goes back to the cmdlet I referenced built into PowerCLI: Get-VasaStorageArray:

So by passing in the array I want and and a datastore name, I am good to go (and a cluster):

$vasaArrays = Get-VasaStorageArray

Mount-PfaVvolDatastore -vasaArray $vasaArrays[<desired index>] -cluster (get-cluster <cluster name>) -datastoreName <datastore name>

Wrapping up

Let’s review setting up VVols from scratch on the FlashArray with PowerCLI now. There are five steps (once the FlashArray has a management IP):

  • Install the PowerShell module
  • Connect to the FlashArray
  • Connect to vCenter
  • Create the host group (and in the case of iSCSI, configure iSCSI targets)
  • Register VASA
  • Mount the VVol datastore

The whole script:

install-module PureStorage.FlashArray.VMware
$flasharray = new-pfaConnection -endpoint flasharray-m50-1 -credentials (get-credential) -ignoreCertificateError -nonDefaultArray
connect-viserver -Server vcenter-02
$cluster = get-cluster Embarcadaro
New-PfaHostGroupfromVcCluster -cluster $cluster -iscsi -flasharray $flasharray
New-PfaVasaProvider -flasharray $flasharray -credentials (get-credential)
Mount-PfaVvolDatastore -flasharray $flasharray -cluster $cluster -datastoreName m50-VVolDS


One Reply to “Mounting a VVol Datastore with PowerCLI”

Leave a Reply

Your email address will not be published.