I'm using yavijava and am required to traverse a vCenter and build a list of all hosts and VMs on it. For each host and VM, I need to retrieve a few properties such as the name, amount of RAM/CPU etc. My current code looks like this:
ManagedEntity[] hosts = new InventoryNavigator.searchManagedEntities("VirtualMachine");
for(int i=0;i<hosts.length;i++) {
String name = hosts[i].getName();
String xxx = hosts[i].XXXXX;
.....
And so on for the VMs too.
My question is, is there a more efficient way to do this considering the fact that there are a significant number of objects and each call (such as getName) sends a new request to vSphere?