One of the great benefits of VVols is that fact that virtual disks are just volumes on your array. So this means if you want to do some data management with your virtual disks, you just need to work directly on the volume that corresponds to it.
The question is what virtual disk corresponds to what volume on what array?
Well some of that question is very array dependent (are you using Pure Storage or something else). But the first steps are always the same. Let’s start there for the good of the order.
- PowerCLI and VVols Part I: Assigning a SPBM Policy
- PowerCLI and VVols Part II: Finding VVol UUIDs
- PowerCLI and VVols Part III: Getting VVol UUIDs from the FlashArray
- PowerCLI and VVols Part IV: Correlating a Windows NTFS to a VMDK
- PowerCLI and VVols Part V: Array Snapshots and VVols
- PowerCLI and VVols Part VI: Running a Test Failover
Since VVols are still a fairly new concept for most, let’s review some basics.
A VVol is a volume on the array that VMware uses for some purpose to represent a VM or store information related to a VM. This could be the home directory information, a virtual disk, snapshots, or more.
How this is represented on the array varies, but at the basic level it is a volume on an array that is also managed by VMware.
Every VVol VM has at least one config VVol. A config VVol holds the home directory information of the VM. This is 4 GB in size and holds files like a VMX file, or logs, or VMDKs, or snapshot hierarchies.
Every time you create a virtual disk, a VMDK pointer file is created in the config VVol and a corresponding volume is created on the array. VMware does not format the data VVol in any way.
A VVol datastore is often best defined by what it is not. It is not a file system, it is not a volume, it is not a disk. It is a capacity quota from a given array. When you create a VM in it, a config VVol is created on the array that “owns” that VVol datastore and that config VVol is associated with it. So when you right click (for instance) on a VVol datastore and choose “Browse files” you will see folders. These folders are just links that redirect you the config VVol. When you browse a folder on a VVol datastore, you are actually looking inside of a config VVol. When you move to a different folder, you are moving to a different config VVol.
Okay that’s the basics.
The first thing to understand about any VVol is that they are all assigned a UUID. This gets assigned when the volume on the array is created. This value is stored on the array (more on that later) and is then also stored inside of the VMDK pointer file (in the case of a data VVol for instance).
So when VMware needs to do something to a virtual disk that is a VVol (resize, delete, reconfigure, etc), VMware gets the UUID and then provides it to the array and the array finds the volume that has that UUID and performs the requested action.
So the nice thing about this is VMware usually does most of this work by communicating this exchange via VASA.
But what if you want to do some peripheral to what VMware can do. Like take a VVol volume and copy it to some other volume. Or report on the average latency. Or whatever?
Well that stuff needs to be done on the array. You can make “eyeball” matches in the GUI, look for the name of the VM, find the corresponding volume in the VM (in the case of the FlashArray the corresponding volume in the volume group that represents the VM) and click away. But that method does not stand up to any level of programmatic scrutiny.
The first step is to get the UUID. There two main types of VVols config VVols and data VVols. Let’s start off with data VVols as this is a bit more straight forward.
In the part 3 of this series, we will then look at what to do on the FlashArray to actually find the volume once you have the UUID.
Finding the Data VVol UUID
There may be other ways of finding this information, but the below is the easiest that I have found.
Remember, this is a PowerCLI post, so I will focus only on that method for now.
First off, I have a VM with 3 VVol virtual disks:
I want to know the UUID of the second virtual disk, called hard disk 2.
I will grab my VM with get-vm:
The next step is to get the disk from the VM. This can be easily achieved by piping the VM into the get-harddisk cmdlet. I will then store my desired virtual disk in $disk:
Now to get the UUID. The UUID can be found in the extension data of the virtual disk under the backing information. The property in there called backingObjectId is the one you want.
This value can come in a few syntactic forms, the form it takes is up to your storage vendor. Most will be in one of the two formats:
RFC 4122 128-bit format with prefix, “rfc4122.xxxxxxxx‐xxxx‐xxxx‐xxxx‐xxxxxxxxxxxx” NAA 128‐bit UUID with prefix, “naa.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
The X’s are all in hex. Some vendors might go with a 64 bit size as well, but in general, 128-bit is used.
So for this particular virtual disk, the corresponding VVol UUID is rfc4122.f403f740-326e-483d-9618-c9d62b04f7c8.
One thing to note, that this value will be a blank string “” for VMFS-based virtual disks and will be null for RDMs. So if you do not get a result, it means the virtual disk is not a VVol.
Finding the Config VVol UUID
So that’s data VVols. Config VVols have the same type of UUID, but it is found in a different way.
Let’s first look at the home directory VVol UUID. This is usually the only one that matters for a given VM.
The VVol UUID of a home directory config VVol can be found under the VM object as well. Once again, you need to access the extension data. Under the VM object, extension data then the config, there is a property called vmStorageObjectId. This shows the home directory config VVol UUID:
Fairly straight forward.
I did say config VVols are a bit trickier and this is somewhat true. Let me explain.
One point I have somewhat glossed over is that a VM can actually have more than one config VVol. This is not super common, but totally possible. A config VVol is really just a small file system (indeed they use VMFS internally)–it is basically a place to put files. With VMFS, or NFS and even VVols, most commonly a VM has a single directory, called the home directory. In VMFS or NFS this is a folder with the VMX file and snapshot directories and swap files etc. In a VVol world, this is a directory which points to its config VVol.
With that being said, sometimes a VM will have a virtual disk on a datastore that is different from where the home directory lies. Therefore there is another folder that is created on the second datastore. So in a VVol world a second config VVol would be created (whether this is on the same array or a different one), which would store the VMDK pointer file for that other data VVol.
First off, how do I know if there is more than one config VVol? Well the simplest way is to run get-datastore on that VM to see if there is more than one VVol datastore associated with that VM.
In this case, I have two VVol datastores associated with this VM. How do I find the UUID for those config VVols? Well one of them is the home, which I can find out like above. But what about the second?
If you detect there is more than one VVol datastore, or you are simply looking for the VVol UUID of a secondary (non-home) config VVol, you can get this from the virtual disk. Unfortunately, I have not seen a way to pull this directly as a property–it seems you must parse the string to get it.
In a given virtual disk (by using get-harddisk) you can access a property in the extension data under backing then file name:
The string under that property starts with the datastore name in square brackets, then a space, then the config VVol UUID then the name of the VMDK. If you split from the last bracket then the slash, and pull the 3rd record you will get that UUID.
So this is how you get the UUIDs of the VVols. In the next post I will talk about how to get them from the Pure Storage FlashArray itself.