Hi,
I am looking for a way to find out all the VMs that belong to a cluster. In other words, I want a list that maps a clusters to all the VMs that run on it.
In the API documentation, I find that “ClousterComputeResouce” has a managed object refence to “HostSystem”.
And “HostSystem” has a managed object reference to the “VirtualMachine”
So I can go like this: ClusterComputeResource->ManagedObjectRefence(HostSystem)->ManagedObjectRefence(VirtualMachine)->whatever_properties_I_need_from_the_VM.
However, this would cause a lot of “Vim::get_views” calls inside a “foreach” loop. This would be deterrent to the performance as the vCetner under question has ~50 clusters and has ~3500 VMs running.
I think this would literally kill the vCenter with so many API calls.
My Question: Is there any other efficient way to find out Cluster and their respective VMs in vSphere Perl SDK.
In vSphere client, we get the “Virtual Machine” tab when we click on the Cluster and can see all the VMs that belong to that cluster. So I am hoping that there must be another easier way out.
Thanks.