Search This Blog

Thursday, September 4, 2014

Unique IDs for VMware virtual machines and ESXi Hosts

Virtual machines - UUID or InstanceUUID 

Historically, Unique ID's or serial numbers have been a challenge within VMware. The lack of Uniqueness limited the number of objects vCenter could manage and the inability to uniquely identify Virtual Machine utilization for asset control.

In the early days of version 3 Virtual Center, VMware virtual machines were unique identified by a managed object reference ID (called a MoREF). MoREF's were were limited to 99 instances and duplicates easily occured. vCenter 4.* came along and several changes were introduced. The Virtual Machine object history of unique identification was as follows

  • Virtual Center 3 
    MoREF's were expanded to 999, but that didn't sufficiently reduce duplicates or allow for more than 999 vm's per vCenter.
  • Virtual Center 4. * 
    UuID was introduced. When a VM is created, ESXi creates the 128-bit integer Uuid such as: 421b4187-bcb4-3dc1-e7d7-c9496d3fdca9 The UUID was how vCenter 4.* tracked a Virtual Machines. This failed however, because duplicates occur during VM copy or cloning.
  • vCenter 4.1 (if I recall correctly) 
    the PersistentID was introduced as a more Persistent identifier.
  • vCenter 5.* - PersistentID was changed to InstanceUuidTherefore, the InstanceUuID is, as of vCenter and ESXi version 5.0, 5.1, and 5.5 is unique. Duplicates for UUID and MOREF may still occur due to replication, copy, or cloning processes.

 

The InstanceUuid, formerly known as PersistentID before it was deprecated, is best known method for unique identification of a virtual machine within a vCenter or a collection of vCenters.

The InstanceUuid is not visible through the vCenter Client, but it is visible through the vCenter API (SDK) or through PowerCLI.

Example 

If connected to a vCenter or ESXi host through PowerCLI, here's a code snippet to view both the UuID and the PersistentID:

PowerCLI InstanceUuid Access Method
PowerCLI C:\> get-vm VirtualMachineName | get-view | % { $_.config } | Format-Table -a *uuid
 
 
Uuid                                 InstanceUuid
----                                 ------------
421b4187-bcb4-3dc1-e7d7-c9496d3fdcb9 501b3ae4-16b3-2d7a-4492-553852f45e62

VM Example 2 - Virtual Machine List

This HTML LINK shows Virtual Machines with their InstanceUuid. The reports converts InstanceUuID to PersistentID for the support of legacy nomenclature:
Click column heading to SORT. 

NamePersistentID TypeState
abbott5027322a-5e15-5a98-4c59-2927e9f9611c VMpoweredOn
acmeascpoc015027ded7-b8fa-8c39-f279-a258fb183992 VMpoweredOn

  

ESXi Physical Servers

VMware's ability to obtain Serial Numbers from Physical Servers is a bit more challenging because server hardware vendors expose those attributes differently.

The object hierarchy is as follows:

$VMhost.Summary.Hardware.OtherIdentifyingInfo.IdentifierType.Key["ServiceTag"].IdentifierValue 

From a vCenter API perspective, the Powershell PowerCLI method is as follows, a simple method is as follows:

PowerCLI VMhost Serial Number
$VMhost = Get-VMhost HostName | Get-View
 
$VMhost.Summary.Hardware.OtherIdentifyingInfowhere {$_.IdentifierType.Key -eq "ServiceTag" } | % { $_.IdentifierValue }
 
[Output Values:]
FOX1605G9YF
FCH17307L8U
 

 

An code Example to get the data formatted in a nicer format follows:

Example - PowerCLI Example to get VMhost and Serial Number

PowerCLI Example to get VMhost and Serial Number
PowerCLI C:\> Get-VMhost  LabServer01 | Get-View select name, @{N="Serial" ; E= { $_.Summar
y.Hardware.OtherIdentifyingInfowhere {$_.IdentifierType.Key -eq "ServiceTag" } | % { $_.IdentifierValu
e }  } }
 
Name           Serial
----           ------
LabServer01   {FOX1605G9YF, FCH17307L8U}

 

As shown in the example above, the code returns 2 values. This occurs because the hardware vendor, Cisco, presents serial numbers per Processor.

8 comments:

  1. Hi Mark,
    Looking at 4.1 vsSphere API docs at https://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/, I see InstanceUUID put no PersistentID. Also, for latest vSphere API doc, instanceUUID fields say "Since vSphere API 4.0". You say instanceUUID didn't appear until 5.0 -- are you sure about that?

    - Jim

    ReplyDelete
    Replies
    1. meant to say "but no PersistentID"

      Delete
  2. 2 returned values? Cisco blade server?... Are your getting the serial number of the server and serial number of the chassis? That was my experience when running a similar script on Cisco servers.

    ReplyDelete
  3. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care.As always, we appreciate you confidence and trust in us.



    Digital Marketing Company in Chennai

    ReplyDelete
  4. Really an awesome post. I wondered by reading this blog post. Thanks a lot for posting this unique post which you have shared with us. Keep on posting like this exclusive post with us.

    Best Seo Training Institute in Chennai

    ReplyDelete
  5. I cant wait to check out some of these blogs! I’ve really wanted to start learning more about cars and auto repairs lately and I think this will help a lot. I think it can save my family some money if we knew how to do some repairs at home.! Thanks again for all the options.

    bike spa services in mumbai
    house cleaning services in mumbai
    car wash services in mumbai

    ReplyDelete
  6. Really nice and definitely it will be useful for many people. Kindly keep update like this.
    Back to original

    ReplyDelete
  7. This blog having the details of Processes running. The way of runing is explained clearly. The content quality is really great. The full document is entirely amazing. Thank you very much for this blog.
    Digital Marketing Company in India

    ReplyDelete