UUID vs. vSphere

UUID stands for universally unique identifier (UUID). It’s a 128-bit value. vSphere uses it as IDs for many different types of entities like HostSystem, VirtualMachine, Datastore, etc.

The UUID surfaces to the vSphere API as well. You can find many methods use UUID as parameter or return result. The most commonly used one is the SearchIndex.findByUuid() which find you a virtual machine or a host based on its UUID, either instance or BIOS UUID. The format used for UUID is as follows:

Bothered by SLOW Web UI to manage vSphere? Want to manage ALL your VMware vCenters, AWS, Azure, Openstack, container behind a SINGLE pane of glass? Want to search, analyze, report, visualize VMs, hosts, networks, datastores, events as easily as Google the Web? Find out more about vSearch 3.0: the search engine for all your private and public clouds.


Since 4.0, DistributedVirtualSwitchManager managed object is added and it has a method called queryDvsByUuid(). As reported by VI Java API community, the standard format doesn’t work. The accepted format is like this:

aa aa aa aa bb bb cc cc-dd dd ee ee ee ee ee ee

I checked the API reference, and found no description about the format. So whatever works is the right format.

To my curiosity, I looked into the MOB (vSphere Client doesn’t normally show you UUIDs). I found 3rd format for datastores as follows:


Now what is the right format for UUID? The most commonly used format is the first one in this blog. Although the format does not affect the final value, it does affect the usage of the API. When you have a string for something like UUID, you should document it in the API reference on its format especially when it’s not the most commonly used format.

Besides format, I would like to add a little more about UUID itself. UUID has different variants or types (see the UUID spec):

Msb0  Msb1  Msb2  Description
0     x     x    Reserved, NCS backward compatibility.
1     0     x    The variant specified in this document. 
1     1     0    Reserved, Microsoft Corporation backward
1     1     1    Reserved for future definition.
(note by Steve: the integer values are 0, 2, 6, and 7 respectively.)

Let’s take a sample with a virtual machine UUID:


The variant is 0. Interesting enough, the datastore uses different variant as 6.


Although these UUIDs come with different variants, they are used as ID. As long as they are unique, they are fine.

BTW, you can use java.util.UUID class to find out more information like variant, version, and optionally time stamp of a UUID.

This entry was posted in vSphere API and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. amogh
    Posted January 15, 2013 at 1:45 am | Permalink

    give me the code for retriving resourcepool uuid,cluster uuid.. plz help me

  2. Posted January 15, 2013 at 2:36 am | Permalink

    Please check out the samples at http://vijava.sf.net. Good luck!

  3. amogh
    Posted January 15, 2013 at 3:04 am | Permalink

    yes steve,am referring that only.. but there is no such code for geting uuid of resourcepool and cluster,give me some simple method to retrive only uuids of them

  4. Posted December 27, 2014 at 3:04 pm | Permalink

    I have read so many articles concerning the blogger lovers
    but this post is genuinely a pleasant article, keep it up.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__ doublecloud.org.

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.