That looks like a reasonable fix. Would you like to try opening a PR to fix
that?

On Fri, 19 Apr 2019 at 00:38, ahsankhanm...@gmail.com <
ahsankhanm...@gmail.com> wrote:

> In the code
> https://github.com/jclouds/jclouds/blob/master/apis/ec2/src/main/java/org/jclouds/ec2/compute/EC2ComputeService.java#L151
>
> If createNdoesInGroup fails to create a tag
> (addTagsAndNamesToInstancesInRegion fails), it currently returns
> AWSResponseException. The caller has no way to cleanup the the failed node
> as the exception doesn't have the node id field. It should return
> RunNodesException which has fields containing failed nodes. The caller can
> then remove such node and retry. To repro the issue try to create a node
> with name larger than 300 character, it will create nodes with empty name
> and possibly multiple of them if caller retries.
>
>  @Override
>    public Set<? extends NodeMetadata> createNodesInGroup(String group, int
> count, final Template template)
>             throws RunNodesException {
>       Set<? extends NodeMetadata> nodes = super.createNodesInGroup(group,
> count, template);
>       String region =
> AWSUtils.getRegionFromLocationOrNull(template.getLocation());
>
>       if (client.getTagApiForRegion(region).isPresent()) {
>          Map<String, String> common =
> metadataAndTagsAsValuesOfEmptyString(template.getOptions());
>          if (generateInstanceNames || !common.isEmpty() ||
> !template.getOptions().getNodeNames().isEmpty()) {
>             return addTagsAndNamesToInstancesInRegion(common,
> template.getOptions().getNodeNames(),
>                     nodes, region, group);
>          }
>       }
>       return nodes;
>    }
>
>

Reply via email to