Using Tags with Storage Policy Based Management

I was doing some work in the lab with Storage Policy Based Management recently. I was using both vSAN and a Virtual Volume array from Nimble Storage. While I was able to create independent policies for both vSAN and VVols, I was curious to see if I could create a policy where I could be offered both datastore types for the initial placement of a VM. For example, if I wanted to ensure my VM was encrypted, could I have a policy which would be compliant with both vSAN datastore and the Virtual Volume datastore, so long as they both offered encryption? I had a quick search around, but I could not find out if anyone had done this before. I’m sure I could do this with “tags” so I began to do some testing. This is what I found:

Let’s start by tagging both of my VVol datastore and my vSAN datastore. This can be done from numerous places from within the vSphere client. Simply select the datastore, and choose the option “Tags and Customer Attributes” from the drop-down menu, then “Assign tag”. If the tag does not already exist, select the option to create a new tag. In this example, I called the tag “VSAN+VVOL” and I also called the new category in which the tagged will be placed “VSAN+VVOL” also. There are other options that you can add at this point too, but I’ve kept this simple:

Once the tag is created, you can assign it to an object. In our case, we will be assigning it to the VSAN and VVOL datastores.

With that done, we can now go ahead and create our policy. This time, when we create our policy, we use the “Tag based placement” as the Storage Type. In the past, for vSAN, this would have been vSAN, or for VVols, this would be the VVol vendor, in this case Nimble Storage.

With the Storage Type set to “Tag based placement”, it is now time to add a rule. The rule that we add in this case is “tags from category”. If you remember, when we created tags from the datastore, we placed them in a category called “VSAN+VVOL”. This is what we are going to select here too:

Now that we have the category set correctly, we can choose any tags from that category. Again, since we only created a single tag called VSAN+VVOL, that is the only tag that we are offered when we click on the “Add tags” above. And so that is the one we will choose:

Now we can continue with the creation of the policy. Like any other policy, the next section is called “Storage compatibility”. This is where you see which storage on your system match the policy that you’ve just created. If we did this correctly, then both the vSAN datastore and the VVol datastore should show as compatible:

There we can see that both the vSAN datastore and the virtual volume datastore from the Nimble storage array are showing up as compatible. If I was to deploy a VM, at the point of initial placement, I would also be offered both of the datastores as compatible on selecting this policy. So yes, through the use of tags, it is possible to have both a vSAN datastore and a VVOl datastore offered for initial placement of a VM.

Some other use cases

Of course, this is only scratching the surface of what tag based placement using policies can do for you. There have been some interesting use cases done with SPBM tags. For example, Jason Langer has written an excellent article on his use of SPBM tags with vSphere Replication to determine where a VM is initially placed. If vSphere Replication is replicating to a datastore as a target, a tag called com.vmware.vrHasVrDisks is added to the datastore. This tag can then be used with “Tag based placement”. Jason used this in a multi-vSAN environment to ensure that VMs were not placed on the target datastore for vSphere Replication, and vice-versa. A neat use case.

Do you have any specific use case around the use of SPBM Tags and policies that I have not shown here. I’d be very interested in hearing from you.

Leave a Reply