Home > vSphere API > Tagging: An Invisible Feature in vSphere

Tagging: An Invisible Feature in vSphere

If you are familiar with social media or research papers, you must know tagging already – You use keywords to label an entity, be it a blog post, an article, or something else, so that it can be easily searched out. So it’s a very useful feature in managing information.

In vSphere 4.0, VMware added tagging capabilities to the managed entities. According to the API reference of 4.1, it’s still an experimental feature and subject to change. While searching the vSphere Client Online Help with tag or tagging, I got nothing. So this feature is still invisible by large.

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

You may wonder, “Why is it there after all?” The answer is that tagging is used indirectly from vSphere Client. Check out the following screenshot of vSphere Client Networking screen.

As you can see two sub-nodes under the same distributed virtual switch. Internally, these two sub-nodes are all represented by the same DistributedVirtualPortgroup type. How come their icons are different? The answer is of course easy – because their usages are different. But how does the vSphere Client know one is used for uplink and the other not?

The trick turns out to be with tagging. The DistributedVirtualPortgroup for uplink (the first one with NIC card icon) has a tag “SYSTEM/DVS.UPLINKPG” while the other does not. So the vSphere Client can read the tag property and use different icons accordingly.

The tag property is defined with ManagedEntity property, therefore in theory you can add and view tags to anything you see in the inventory tree: host, virtual machine, etc. But it is not supported on GUI anyway probably due to experimental nature of this feature.

You can find the tag property from a MOB. As it turns out, tagging is not widely used among managed entities. The tag property of most managed entities I checked is empty.
Reading the API reference, I could not find any method or any way to add/remove a tag – this is probably an explanation why tagging is not widely used.

This is not abnormal in vSphere API in the light that this is an experimental feature. Even if it’s not experimental, it’s still normal given that there are similar properties like “childType” that are reserved for the system instead for users.

Let’s hope that tagging feature becomes official in the future, meaning you can change from vSphere Client GUI and via vSphere APIs.

Update: William Lam published a great follow up post on changing tags with MOB.

Categories: vSphere API Tags: , , ,