I'm having issues with custom vm naming in vRA 8.1 when running simultaneous deployments.
I'm using LockingSystem.lockAndWait(lockID ,lockOwner) within my custom naming workflow to ensure no parallel runs. Part of script in the workflow pulls a list of vm's from vCentre with a set prefix at which point a useable vm name is determined populating the resourceNames array.
The workflow is subscribed to the compute allocation event topic and blocking is enabled, but upon execution of a second deployment, (executed within a few seconds of the first), vm names are being returned that were reserved by the first deployment. It's difficult to determine exactly whats going on. The events page in Extensibility is slow and clunky, but given blocking is enabled, and a single deployment works without a problem, it feels like the event subscription is completing before the vm's are being created in vCentre.
Does anyone have any experience of this or can offer any assistance in figuring out whats happening, or more likely, what I'm doing wrong!
I assume you are running a vRO workflow for your custom naming that gets triggered by an event subscription.
Note that the blocking on the event subscription ensure your custom naming workflow completed before going to the next step in the provisioning workflow, without it the name would likely not be allocated.
It sounds like you query vCenter to determine names already in use and then increment a value to create a unique name. It does take a while to get the VM created, during which time the name wouldn't be returned from a vCenter query if your workflow runs again within seconds. You could either use the custom naming within vRA or statefull storage to track what you allocated (config file on file share, sql etc.)
Thanks for your reply.
You're correct with respect to me using a custom naming workflow and querying vCentre. vRA 8 custom naming doesn't quite meet my requirements.
I think a weekend away from this has helped, as I've come back to it, added a 60 second sleep timer once the lock and wait completes, and now multiple deployments executed within seconds of one another are now returning unique vm names.
If there is no method of receiving a return code once the create vm process has been handed off to vCentre, I suspect any method of custom naming is subject to failure if deployments are executed at exactly the same time.
You could trigger it on the "Compute Provision" event, but the creation of the VM in vCenter is not immediate when the event starts so you will have to work out the timing and then put a wait/sleep command in it before you send the return code.