diff --git a/compute/src/main/java/org/jclouds/compute/RunNodesException.java b/compute/src/main/java/org/jclouds/compute/RunNodesException.java index 6c809ad305..d6e73d1074 100644 --- a/compute/src/main/java/org/jclouds/compute/RunNodesException.java +++ b/compute/src/main/java/org/jclouds/compute/RunNodesException.java @@ -35,26 +35,26 @@ public class RunNodesException extends Exception { /** The serialVersionUID */ private static final long serialVersionUID = -2272965726680821281L; - private final String tag; + private final String group; private final int count; private final Template template; private final Set successfulNodes; private final Map failedNodes; private final Map executionExceptions; - public RunNodesException(String tag, int count, Template template, + public RunNodesException(String group, int count, Template template, Set successfulNodes, Map executionExceptions, Map failedNodes) { super( String .format( - "error running %d node%s tag(%s) location(%s) image(%s) size(%s) options(%s)%n%s%n%s", - count, count > 1 ? "s" : "", tag, template.getLocation().getId(), + "error running %d node%s group(%s) location(%s) image(%s) size(%s) options(%s)%n%s%n%s", + count, count > 1 ? "s" : "", group, template.getLocation().getId(), template.getImage().getProviderId(), template.getHardware() .getProviderId(), template.getOptions(), createExecutionErrorMessage(executionExceptions), createNodeErrorMessage(failedNodes))); - this.tag = tag; + this.group = group; this.count = count; this.template = template; this.successfulNodes = successfulNodes; @@ -86,8 +86,8 @@ public class RunNodesException extends Exception { return failedNodes; } - public String getTag() { - return tag; + public String getGroup() { + return group; } public int getCount() { diff --git a/compute/src/main/java/org/jclouds/compute/strategy/impl/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/compute/src/main/java/org/jclouds/compute/strategy/impl/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java index 900107431e..a1f1a80013 100644 --- a/compute/src/main/java/org/jclouds/compute/strategy/impl/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java +++ b/compute/src/main/java/org/jclouds/compute/strategy/impl/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java @@ -62,12 +62,12 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet implements CreateNo private class AddNode implements Callable { private final String name; - private final String tag; + private final String group; private final Template template; - private AddNode(String name, String tag, Template template) { + private AddNode(String name, String group, Template template) { this.name = checkNotNull(name, "name"); - this.tag = checkNotNull(tag, "tag"); + this.group = checkNotNull(group, "group"); this.template = checkNotNull(template, "template"); } @@ -77,13 +77,13 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet implements CreateNo logger.debug(">> adding node location(%s) name(%s) image(%s) hardware(%s)", template.getLocation().getId(), name, template.getImage().getProviderId(), template.getHardware() .getProviderId()); - node = addNodeWithTagStrategy.createNodeWithGroupEncodedIntoName(tag, name, template); + node = addNodeWithGroupStrategy.createNodeWithGroupEncodedIntoName(group, name, template); logger.debug("<< %s node(%s)", node.getState(), node.getId()); return node; } public String toString() { - return toStringHelper(this).add("name", name).add("tag", tag).add("template", template).toString(); + return toStringHelper(this).add("name", name).add("group", group).add("template", template).toString(); } } @@ -91,7 +91,7 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet implements CreateNo @Resource @Named(ComputeServiceConstants.COMPUTE_LOGGER) protected Logger logger = Logger.NULL; - protected final CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy; + protected final CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy; protected final ListNodesStrategy listNodesStrategy; protected final String nodeNamingConvention; protected final ExecutorService executor; @@ -99,12 +99,12 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet implements CreateNo @Inject protected CreateNodesWithGroupEncodedIntoNameThenAddToSet( - CreateNodeWithGroupEncodedIntoName addNodeWithTagStrategy, + CreateNodeWithGroupEncodedIntoName addNodeWithGroupStrategy, ListNodesStrategy listNodesStrategy, @Named("NAMING_CONVENTION") String nodeNamingConvention, @Named(Constants.PROPERTY_USER_THREADS) ExecutorService executor, CustomizeNodeAndAddToGoodMapOrPutExceptionIntoBadMap.Factory customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory) { - this.addNodeWithTagStrategy = addNodeWithTagStrategy; + this.addNodeWithGroupStrategy = addNodeWithGroupStrategy; this.listNodesStrategy = listNodesStrategy; this.nodeNamingConvention = nodeNamingConvention; this.executor = executor; @@ -112,15 +112,15 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet implements CreateNo } /** - * This implementation gets a list of acceptable node names to encode the tag into, then it + * This implementation gets a list of acceptable node names to encode the group into, then it * simultaneously runs the nodes and applies options to them. */ @Override - public Map> execute(String tag, int count, Template template, Set goodNodes, + public Map> execute(String group, int count, Template template, Set goodNodes, Map badNodes, Multimap customizationResponses) { Map> responses = newLinkedHashMap(); - for (String name : getNextNames(tag, template, count)) { - responses.put(name, compose(executor.submit(new AddNode(name, tag, template)), + for (String name : getNextNames(group, template, count)) { + responses.put(name, compose(executor.submit(new AddNode(name, group, template)), customizeNodeAndAddToGoodMapOrPutExceptionIntoBadMapFactory.create(template.getOptions(), goodNodes, badNodes, customizationResponses), executor)); } @@ -128,22 +128,22 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet implements CreateNo } /** - * Find the next node names that can be used. These will be derived from the tag and the + * Find the next node names that can be used. These will be derived from the group and the * template. We will pre-allocate a specified quantity, and attempt to verify that there is no * name conflict with the current service. * - * @param tag + * @param group * @param count * @param template * @return */ - protected Set getNextNames(final String tag, final Template template, int count) { + protected Set getNextNames(final String group, final Template template, int count) { Set names = newLinkedHashSet(); Iterable currentNodes = listNodesStrategy.listNodes(); int maxTries = 100; int currentTries = 0; while (names.size() < count && currentTries++ < maxTries) { - final String name = getNextName(tag, template); + final String name = getNextName(group, template); if (!any(currentNodes, new Predicate() { @Override @@ -159,14 +159,14 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet implements CreateNo } /** - * Get a name using a random mechanism that still ties all nodes in a tag together. + * Get a name using a random mechanism that still ties all nodes in a group together. * - * This implementation will pass the tag and a hex formatted random number to the configured + * This implementation will pass the group and a hex formatted random number to the configured * naming convention. * */ - protected String getNextName(final String tag, final Template template) { - return String.format(nodeNamingConvention, tag, Integer.toHexString(new SecureRandom().nextInt(4095))); + protected String getNextName(final String group, final Template template) { + return String.format(nodeNamingConvention, group, Integer.toHexString(new SecureRandom().nextInt(4095))); } } \ No newline at end of file