Steps to create VM-Datastore affinity using Tag based Storage Profiles
book
Article ID: 404217
calendar_today
Updated On:
Products
VMware vCenter Server
Issue/Introduction
Tag-based storage profiles allow for VM-Datastore affinity by creating storage policies that filter datastores based on tags.
This ensures that VMs are placed on datastores that meet specific criteria, such as performance levels, encryption requirements, or replication needs, during creation, cloning or migration.
Environment
VMware vCenter Server
Resolution
Storage Policies (SPBM): Define what kind of storage a VM is allowed to use (based on tags or capabilities).
Tags: Provide metadata about datastores — e.g: “SQL”, “nonSQL”
STEPS:
Create tags (SQL and nonSQL) and tag the datastores appropriately.
Create Storage Policies that use Tags as rules.
Assign the correct Storage Policy to each VM or VM template. This way, the policy only matches datastores in the intended datastore cluster.
Storage vMotion, Storage DRS, or manual migration will only allow placement to matching datastores.
IMPLEMENTATION WITH EXAMPLE:
There are 2 datastore clusters:
DatastoreCluster-SQL
DatastoreCluster-nonSQL
Each datastore in DatastoreCluster-SQL is tagged with StorageType = SQL
Each datastore in DatastoreCluster-nonSQL is tagged with StorageType = nonSQL.
CREATE TAGS:
Go to vSphere Client -> Menu -> Tags & Custom Attributes
Create a Category named StorageType and select Associable Object Types: Datastores
Go to TAGS -> Add tags named SQL and nonSQL and select StorageType as the category.
CREATE STORAGE POLICIES:
Go to Menu -> Policies and Profiles -> VM Storage Policies.
Create a new VM Storage Policy called SQL-StoragePolicy.
Under Policy structure, select Datastore specific rules = Enable tag based placement rules
Select the 'tag based placement' as below:
Similarly, create a VM Storage Policy called nonSQL-StoragePolicy.
Select the 'tag based placement' as below:
ASSIGN POLICY TO THE VMs:
Right-click VM -> VM Policies -> Edit VM Storage Policies.
For SQL VMs, from the dropdown, select SQL-StoragePolicy
For nonSQL VMs, from the dropdown, select nonSQL-StoragePolicy
The storage policies to the VMs can be applied in powered ON state.