VMware {code} Community
jrackliffe
Hot Shot
Hot Shot

GetHost from a VirtualMachine ManagedObjectReference

Using the SOAP interfaces via C# proxies

I have a VM ManagedObjectRef and I wanted to derive the HostSystem for it. From what I see in the MOB it seems like the only way to get it would be to walk up to the DC for the VM using the VM.parent and then walk down via the hostFolder and check each Host.vm[] in the DC for the VM.value.

Am I just missing the easy route?

0 Kudos
2 Replies
bclow
Enthusiast
Enthusiast

Check out: http://pubs.vmware.com/vi301/sdk/ReferenceGuide/vim.vm.RuntimeInfo.html

vm.runtime.host contains a ManagedObjectReference to the HostSystem for the VM, if it's running or assigned to run on a particular host.

0 Kudos
jrackliffe
Hot Shot
Hot Shot

Arrgghhh! Man I knew it was going to be obvious. Didn't think of checking the runtime reference.

Thanks!

0 Kudos