VMware {code} Community
amalgs
Contributor
Contributor

java wmware API. How long can I keep reference to virtualMachine for powering on/off

Hi,

I am trying to refactor some code to monitor/power a set of vms because we just noticed it was generating much input traffic load to the machine hosting the monitor software. Currently, we obtain the reference to each virtual machine before powering on/off by searching through the inventory navigator:

ManagedEntity vm = new InventoryNavigator(getServiceInstance().getRootFolder())
   .searchManagedEntity("VirtualMachine", name);

 

(we use wmware java API wmware com.vmware.vm25.mo)

I am trying to avoid this kind of search everytime for each virtual machine because, from my tests, I could see that the call to getRootFolder() in the inventory was generating much input traffic.

I am wondering if I could get the list of references to all the hosts once when the monitor software starts and use further the references to the virtualMachine entities stored in that list. However, how long can I keep such references on my code? Would some action like migrating VM from blade result in out of date references and failing power on/off?

I appreciate very much any hint!

Thanks a lot,

0 Kudos
0 Replies