Best Practices for vSphere 6.7 Tagging

Best Practices for vSphere 6.7 Tagging

This post was originally published on this site ---

vSphere Tags were introduced in version 5.1 as a way to organize inventory objects such as VMs, Hosts, Datastores, etc., a much-needed feature for helping search for or group objects within vSphere. A Tag is basically a label that can be applied to vSphere inventory objects. When an administrator creates a tag, it is then assigned to a tag category. Categories allow the grouping of related tags. When a Category is created, you can specify associations of object types (such as; VM or Datastore) as well as whether more than one tag in a category can be applied to an object (ex; One Tag or Many Tags).

 

Although vSphere documentation has existed for working with tags, there has not been much available in regards to how tagging performance or scale can potentially affect an environment. A white paper on this topic was released near the end of 2019, VMware vSphere 6.7 Tagging Best Practices by Ravi Soundararajan, Principal Engineer in the Performance Engineering group at VMware.

 

 

vSphere 6.7 Tags

Ravi covers tagging from top to bottom starting with vSphere 5.1 when tags were introduced, to common terminology used when discussing tags, using tagging APIs whether in Java or PowerShell, Scale and Performance as they relate to tag operations, and also touches on Tags vs. Custom Attributes.

The whitepaper also contains a few bits of both Java & PowerCLI code to help get started right after reading. Examples below:

11.2.9 Example J8: List VMs associated with a tag (pg.27)

// List tags associated with tagId from above
// Assumes tagAssociation object from above
List<DynamicID> retDynamicIds = tagAssociation.listAttachedObjects(tagId);

11.3.2 Example P1: List tags associated with a VM (pg.28)

$allCategoryMethodSVC = Get-CisService com.vmware.cis.tagging.category
$alltagMethodSVC = Get-CisService com.vmware.cis.tagging.tag
$allTagAssociationMethodSVC = Get-CisService com.vmware.cis.tagging.tag_association
# Use first VM from above list
$useThisVMID = $useTheseVMIDs[0]
$tagList = $allTagAssociationMethodSVC.list_attached_tags($useThisVMID)

This resource is quite invaluable to those looking to use vSphere tags efficiently and effectively.

Additional Resources

To learn more about vSphere Tags and relevant tooling, please review these resources:

 

Take our vSphere 6.7: Getting Started Hands-On Lab here, and our vSphere 6.7: Advanced Topics Hands-On Lab here!

 

 

The post Best Practices for vSphere 6.7 Tagging appeared first on VMware vSphere Blog.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.