VM Datastore Placement using VCF Automation Storage Profiles

Updated: 11 hours ago
I built a VCF Automation Blueprint allowing the consumer to select the Datastore for their VM, but it wasn't landing on that Datastore. Here's how I fixed it. Screenshots here are taken from VCF Automation 8.18.1.
I created a Storage Profile for each Datastore including a Capability tag.

I used the Capability Tag of ds:vsandatastore in this case because that's the name of the Datastore I assigned to this Storage Profile.

You'd do this same thing for each Datastore store being presented in your Blueprint. That is, each Datastore would have its own Storage Profile (with associated Capability Tag).
In the Blueprint, request the Datastore as input from the consumer like this in your inputs stanza.
datastore:
type: string
title: Datastore
default: ds:vsandatastore
oneOf:
- title: vSAN Datastore
const: ds:vsandatastore
- title: Another Datastore
const: ds:anotherdatastore
The title is what the user sees, const is the mapping to the Storage Profile Capability Tag, which maps to the respective Datastore.
Later in the Blueprint, in the resources stanza tell the VM to use that Datastore.
resources:
Cloud_Network_1:
type: Cloud.Network
properties:
networkType: existing
Cloud_vSphere_Machine_1:
type: Cloud.vSphere.Machine
properties:
name: ${input.vm_display_name}
hostname: ${input.vm_dns_name}
imageRef: ${input.os}
cpuCount: ${input.vcpu}
totalMemoryMB: ${input.MemoryMB}
customizationSpec: ${input.customizationspec}
networks:
- network: ${resource.Cloud_Network_1.id}
assignment: static
address: ${input.ip}
storage:
constraints:
- tag: ${input.datastore}
Now when a user requests a VM using the Blueprint, it'll look like this.

Notice the two Datastore options, I've selected the vSAN Datastore, which gets mapped to ds:vsandatastore in my Blueprint, which is mapped to the vSAN Datastore Storage Profile via Capability Tag, which is configured to use the vSAN Datastore.

There it is, great way to use Storage Profiles! In summary:
Storage Profile per Datastore
Set Capability Tag to ds:datastorename
Select desired Datastore in the Storage Profile Datastore tab
Adjust Blueprint as detailed above
If you want the entire Blueprint you can get it here. Hope this was helpful, enjoy!



Comments