VMware Cloud Community
viniciusgb4
Contributor
Contributor
Jump to solution

Is there a way to get Host from VM?

Hi,

I'm needing to know which host a VM is. In HostSystem there is a property called vm, but in VirtualMachine there is no a host property. Is there a way to know which host my VM is, from the VM.

Thank you all!

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
mcowger
Immortal
Immortal
Jump to solution

VirtualMachine.VirtualMachineRuntimeInfo.host is a MOR to the relevant Host object.

--Matt VCDX #52 blog.cowger.us

View solution in original post

0 Kudos
3 Replies
a_nut_in
Expert
Expert
Jump to solution

Though there is no direct way, the vmware.log of the VM logs the host the VM starts on (on a power on) and also logs which host it migrates to.

So the start of the log would contain

2013-01-02T15:02:33.787Z| vmx| I120: Hostname=xxxxx

and a migrate would contain

2013-01-02T15:02:34.463Z| vmx| I120: Migrate_Open: Restoring from <IP ADDRESS> with migration id 1357138953

Regards

a

Do remember to mark my post as "helpful" or "correct" if I've helped resolve or answer your query!
mcowger
Immortal
Immortal
Jump to solution

VirtualMachine.VirtualMachineRuntimeInfo.host is a MOR to the relevant Host object.

--Matt VCDX #52 blog.cowger.us
0 Kudos
viniciusgb4
Contributor
Contributor
Jump to solution

Thank you all. mcowger, it was what I needed.

0 Kudos