I am using the VIX API to do a simple set of operations
I open a vm, revert to a snaphsot, then power on the vm and run some commands on it. Finally I close it. I have one difficulty in that the vm can be accessed by multiple VIX API clients - performing the same sequence. The clients are independent of each other. The single shared resource is the vm. I was wondering if it is possible somehow to prevent the multiple clients accessing the vm at the same time. I want the whole operation from reverting the snapshot to powering off the vm to be atomic. I see that I can detect the power state and act accordingly, but this leaves a gap while I am doing the revert to snapshot. Is it maybe possible to use the WriteVariable and ReadVariable functions to act as flags?
Thanks for your help in anticipation!
Vix deosn't have any way to lock a VM. RaedVaraible and WriteVariable (of type VIX_VM_CONFIG_RUNTIME_ONLY) might allow you to put your own hints in place (still plenty of room for races though). Note that since those values are presisted in the .vmx file, choose your variable names closely (you don't want to affect the VM by setting something important) and error recovery may also get tricky if your app exits uncleanly and doesn't clear the flag.
Vix deosn't have any way to lock a VM. RaedVaraible and WriteVariable (of type VIX_VM_CONFIG_RUNTIME_ONLY) might allow you to put your own hints in place (still plenty of room for races though). Note that since those values are presisted in the .vmx file, choose your variable names closely (you don't want to affect the VM by setting something important) and error recovery may also get tricky if your app exits uncleanly and doesn't clear the flag.
Thanks for your helpful answer lemke. I think I will look at creating an external locking mechanism. I did think I could use the VIX_VM_GUEST_VARIABLE flag to have the variables created with WriteVariable not persistent. I wasn't sure though if the variables would become immediately available to other sessions managing this VM. The documentation (http://www.vmware.com/support/developer/vix-api/vix17_reference/) gave me to believe the values would be volatile if I use the VIX_VM_GUEST_VARIABLE flag.
