VMware {code} Community
pjudson
Contributor
Contributor
Jump to solution

Is ManagedObjectReference.value always the same?

I have seen other topics around this but I haven't seen a definitive answer on this.

I understand that you can't save off a ManagedObjectReference (MOR) and be guaranteed that it won't change. My question though is whether the MOR.value field is[/i] always the same for a given object, even if its MOR changes.

In otherwords if I save off MOR.value for an object and then come along at some later time and retrieve a list of MORs (say by using a TraversalSpec) and I find an MOR with the same value I saved off it is guaranteed that it is the same object?

Thanks,

Paul

0 Kudos
1 Solution

Accepted Solutions
SaranshG
Enthusiast
Enthusiast
Jump to solution

Yes the ManagedObjectReference.value is always the same for an Object.

View solution in original post

0 Kudos
3 Replies
SaranshG
Enthusiast
Enthusiast
Jump to solution

Yes the ManagedObjectReference.value is always the same for an Object.

0 Kudos
tantal
Contributor
Contributor
Jump to solution

I once again raise this question.

pg. 58 of the "Virtual Machine Backup Guide" (http://www.vmware.com/pdf/vi3_vm_backup.pdf ), section "Identifying Virtual Machines by MoRef" states the following:

"Because MoRefs change every time the VirtualCenter or the host instance that Consolidated Backup connects to restarts, you should not use MoRefs to identify virtual machines."

From the context, the MoRef in question was exactly the value discussed here (e.g. vm-00027 for VC and 248 for ESX).

So I will ask again:

1) Are MoRef values constant during the lifetime of the object?

2) Are MoRef values stored in the database? If my VC host crashes, but the underlying database (MSSQL, Oracle) is intact, if I point a new VC to the existing database, will I see same MoRef values as before the crash?

3) Are MoRef values incremental or do they get reused after an object is destroyed?

Are there any version-specific exceptions one should be aware of?

0 Kudos
dmhaynes
Enthusiast
Enthusiast
Jump to solution

My experience says the following:

1. MoRefs are constant for the life of the VirtualCenter. If you upgrade VirtualCenters, you may lose the MoRef links (along with templates, but that is another story) This follows the 'Discovered VMs' model.

2. MoRefs are stored in the database.

3. MoRefs are not reused. They are driven off a master incrementing table.

In dealing with MoRefs, I think you need to follow VirtualClient's example and plan on synchronizing with VirtualCenter prior to performing any actions.

0 Kudos