VMware {code} Community
george_cosmin
Contributor
Contributor

refresh rootSnapshotList after a change


Hello


the idea is to have a Virtual Machine object instantiated somewhere soon in code 


at that point lets say that $vm->snapshot->rootSnapshotList has a couple oh sub snapshots , lets call them snap1,snap2 and snap3 


meanwhile  i add a new snapshot ( CreateSnapshot_Task(%args) )  ,


if i browse the rootSnapshotList , i will not see the newly created snapshot , in order to see it i must instanciate a new VM object and access its rootSnapshot 


now consider i have 100 VMs ready to be reinstanciated or even 1000 , that would not be so nice to call find_entity_view for each one no ?


Did vmware do any subroutine to re-scan the snapshots in a VM ?


I have tried  $vm->Reload  but to no avail 

0 Kudos
1 Reply
stumpr
Virtuoso
Virtuoso

update_view_data() is probably the method you want.

$vm->update_view_data();

You could also get a bit more robust and leverage the WaitForUpdatesEx() method of the PropertyCollector.  Then you could just have a list of entities (VMs, Hosts, etc) and have those updated on demand with just changes in a single API invocation.  But usually the update_view_data() method works in most cases without the extra complexity.

Reuben Stump | http://www.virtuin.com | @ReubenStump
0 Kudos