VMware {code} Community
beckhamk
Enthusiast
Enthusiast
Jump to solution

host-xyz or UUID?

I would like to know which is a better method for identifing items in VC using the API.

Would it be the keyname ie: vm-123 or the UUID?

I ask this because if I write an application to store on of these, and VC needs to be installed fresh. I know that the vm-xxx will get renumbered. So that leads me to believe UUID is king here.

0 Kudos
1 Solution

Accepted Solutions
stumpr
Virtuoso
Virtuoso
Jump to solution

UUID. It can be altered by someone with rights to the VMX configuration file or when you get the copy/move dialog, but otherwise its probably your best bet.

Reuben Stump | http://www.virtuin.com | @ReubenStump

View solution in original post

0 Kudos
5 Replies
stumpr
Virtuoso
Virtuoso
Jump to solution

UUID. It can be altered by someone with rights to the VMX configuration file or when you get the copy/move dialog, but otherwise its probably your best bet.

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
dmitrif
Enthusiast
Enthusiast
Jump to solution

Depends whether you need this to be persistent between connections.

The "host-xyz" is good enough if you don't need one; it also easy to work with.

D.
beckhamk
Enthusiast
Enthusiast
Jump to solution

We need to store one of the value and it can not change. ( i understand someone could change it) but we are not concerned with a person changing it. We just dont want to have to resync everything if VC has to be freshing installed with no backup. As all of the vm-xxx get renumbered which is no good.

0 Kudos
stumpr
Virtuoso
Virtuoso
Jump to solution

I would use UUID. If you are rebuilding the inventory (add existing VMs into vCenter), then it is possible the UUID would change depending on how the admin answers the move/copy question. If you wanted to be particularly sneaky, you could generate your own SID and store it with the vmx configuration as a custom value. Then you could just retrieve this custom value. Unless an admin were to manually edit that value out, it should be persistent across any moves, copies, etc. I guess you could just use the Virtual Machine UUID as it exists, store it in a custom value and then store it in your application. That way you always have it regardless of copy-move ops. Generally most VMware admins know how to properly answer the question since it affects the UUID and Mac address, but some people just do a safe "copy" answer.

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos
dmitrif
Enthusiast
Enthusiast
Jump to solution

Yes, you definitely need UUIDs, but not all managed objects have them.

I see nothing wrong with storing managed object types and names, warning users that they should not rename entities without our product watching it, then reinstall VC or ESX and expect that it will be all magically resolved.

If I were you I'd use a combination of UUIDs if available and types/names otherwise; definitely not managed object ids.

D.
0 Kudos