> +      final String deploymentTemplate = 
> UrlEscapers.urlFormParameterEscaper().escape(json.toJson(properties));
> +
> +      logger.debug("Deployment created with name: %s", name);
> +
> +      final Set<VMDeployment> deployments = Sets.newHashSet();
> +      if (!retry(new Predicate<String>() {
> +         @Override
> +         public boolean apply(final String name) {
> +            runningNumber++;
> +
> +
> +            ResourceGroupApi resourceGroupApi = api.getResourceGroupApi();
> +            ResourceGroup resourceGroup = resourceGroupApi.get(getGroupId());
> +            String resourceGroupName;
> +
> +            if (resourceGroup == null){

Race conditions may appear here! When calling 
`computeService.createNodesInGroup` to create more than one node, jclouds will 
call this method concurrently.
If you need to perform some operations that affect *all* nodes being deployed, 
and perform them just once (such as creating a group, creating the networks or 
security groups indicated in the options, etc), then the right approach is to 
override the `CreateNodesInGroupThenAddToSet` strategy to do that. Take the 
[DigitalOcean 
one](https://github.com/jclouds/jclouds/blob/master/providers/digitalocean2/src/main/java/org/jclouds/digitalocean2/compute/config/DigitalOcean2ComputeServiceContextModule.java#L92)
 as an example. That strategy is invoked only once, just before spawning N 
threads to create the nodes concurrently.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/267/files/bae5d6dfcdb26e31057db4551c5996836666a31b#r63964298

Reply via email to