VMware Cloud Community
SelfRich
Contributor
Contributor

SQL Select Statement needed to identify all hosts a virtual machine can run

I have the need to query the VirtualCenter database and report all of the ESX hosts that a virtual machine CAN run on, not just the host it is currently running on.

I have been trying to use a ER diagram to create the SQL select statement without any luck.

I have created the select statement that would match the current vmware sessions to the host they are currently running, but have not figured out the relationship to the machines that the vmware session COULD run on if moved by Vmotion. What are the tables that Vmotion would use to move a virtual machine from one host to another?

Has anyone created this SQL statement?

My output from the SQL would summarize - I have a virtual machine and the virtual machine could run on 3 ESX hosts in a datacenter with 20 hosts. The output would list all of the virtual machines like this.

0 Kudos
0 Replies