VMware Cloud Community
BillSkulley
Contributor
Contributor

Detect Locked Files

We've got a pretty decent workflow strung together to deploy new vApps in to vCloud using vCO.  Nothing super fancy, but it works, using vCloud and vCO 5.1.

What we're seeing is the occasional case where two near-simultaneous attempts are made to clone from the same vCD Catalog item (vm guest), which of course causes a failure on the second attempt as the files are locked by the first clone.  We can naturally trap this occurence from the error which is returned, but is it possible to query vCloud/vCenter/vSphere to pre-check the state of the files before attempting the clone?  This would be cleaner from a error log perspective, but we've not been able to identify a method/call to accomplish this.

Thanks!

0 Kudos
2 Replies
cdecanini_
VMware Employee
VMware Employee

There are at least three ways to solve this:

Attempting the update, if failing because in use leverage the exception handling to attempt the change later.

A more advanced way would be to check for an active task on the object and wait this task to finish. This is more complicated to implement. First you need to get the last active task for this object then you have the problem of having several workflows waiting for the task to complete and all starting the operation at the same time.

The last one is to use the vCO locking system. Look at the library workflows for the locking system. You should lock on the object id before the wait for task and unlock after. If you do so another instance of your worklow will wait until the lock is released. You can use the locking system If the only way to make a resource busy is your worflow. The vCO locking system will not lock resources for a vCloud Director UI started operation (or anything besides the worflow where you have implemented the locking)

You can also combine these together.

Christophe.

Le Mar 4, 2013 à 11:21 PM, "BillSkulley" <communities-emailer@vmware.com<mailto:communities-emailer@vmware.com>> a écrit :

VMware Communities<http://communities.vmware.com/index.jspa>

Detect Locked Files

created by BillSkulley<http://communities.vmware.com/people/BillSkulley> in Orchestrator - View the full discussion<http://communities.vmware.com/message/2205335#2205335

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
BillSkulley
Contributor
Contributor

Was hoping there was something more granular that would detect a current "lock" state regardless of source, but thanks for the answer.  We'll continue down the road of trapping the (inevitable) errors.


Thanks!

0 Kudos