Hi All,
I had an idea today to start sharing some questions/use cases from current implementations of vCO so that more people can benefit from that. I believe that most of the things that I will try to regularly share are documented or explained at various places but broadcasting them again to the community could be helpful.
So, todays use case is related to locking. vCenter Orchestrator provides a locking capability that according to the official documentation is:
"Locking mechanism for automated processes, that allows workflows to lock the resources they use.
The use case is when you might endup with a few sequential request to change the state of an inventory (external system) object. For example Wf1 uses a VM (vm-478) and Wf2 running a few milliseconds has another state for the VM object, cause Wf1 changed something. This could be especially useful when workflows run in parallel.
So, todays use case is related to locking. The use case is when you might end up with a few sequential requests to change the state of an inventory (external system) object. For example Wf1 uses a VM (vm-478) and Wf2 running a few milliseconds has another state for the VM object, cause Wf1 changed something. This could be especially useful when workflows run in parallel. In such a case, there are example workflows in Library/Locking folder.
The scripting is the following:
var lockId = "vm-478";
System.log( "Try to lock with lockId:'" + lockId + "' for owner:'" + owner + "'" );
LockingSystem.lockAndWait( lockId, owner );
System.log( "Locked id:'" + lockId + "' for owner:'" + owner + "'");
System.log( "I'm doing my job..." );
//do some job.
System.log(" ... Job done !" );
LockingSystem.unlock( lockId, owner );
System.log( "Unlocked id:'" + lockId + "' for owner:'" + owner + "'");
Hope, it is helpful.
Thanks,
Igor.