mirror of https://github.com/apache/jclouds.git
Issue 130: clarified method names
git-svn-id: http://jclouds.googlecode.com/svn/trunk@2731 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
parent
3521c47029
commit
99dd7c1638
|
@ -149,7 +149,7 @@ public class EC2ComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeSet runNodes(String tag, int count, Template template) {
|
public NodeSet runNodesWithTag(String tag, int count, Template template) {
|
||||||
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
|
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
|
||||||
checkArgument(template.getSize() instanceof EC2Size,
|
checkArgument(template.getSize() instanceof EC2Size,
|
||||||
"unexpected image type. should be EC2Size, was: " + template.getSize().getClass());
|
"unexpected image type. should be EC2Size, was: " + template.getSize().getClass());
|
||||||
|
@ -303,7 +303,7 @@ public class EC2ComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroyNodes(String tag) { // TODO parallel
|
public void destroyNodesWithTag(String tag) { // TODO parallel
|
||||||
logger.debug(">> terminating servers by tag(%s)", tag);
|
logger.debug(">> terminating servers by tag(%s)", tag);
|
||||||
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
|
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
|
||||||
for (final NodeMetadata node : doGetNodes(tag)) {
|
for (final NodeMetadata node : doGetNodes(tag)) {
|
||||||
|
@ -325,7 +325,7 @@ public class EC2ComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeSet getNodes(String tag) {
|
public NodeSet getNodesWithTag(String tag) {
|
||||||
logger.debug(">> listing servers by tag(%s)", tag);
|
logger.debug(">> listing servers by tag(%s)", tag);
|
||||||
NodeSet nodes = doGetNodes(tag);
|
NodeSet nodes = doGetNodes(tag);
|
||||||
logger.debug("<< list(%d)", nodes.size());
|
logger.debug("<< list(%d)", nodes.size());
|
||||||
|
|
|
@ -42,7 +42,12 @@ public interface ComputeService {
|
||||||
TemplateBuilder templateBuilder();
|
TemplateBuilder templateBuilder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* all sizes available to the current user by id
|
* The get sizes command shows you the options including virtual cpu count, memory, and disks.
|
||||||
|
* cpu count is not a portable quantity across clouds, as they are measured differently. However,
|
||||||
|
* it is a good indicator of relative speed within a cloud. memory is measured in megabytes and
|
||||||
|
* disks in gigabytes.
|
||||||
|
*
|
||||||
|
* @retun a map of sizes by ID, conceding that in some clouds the "id" is not used.
|
||||||
*/
|
*/
|
||||||
Map<String, ? extends Size> getSizes();
|
Map<String, ? extends Size> getSizes();
|
||||||
|
|
||||||
|
@ -58,7 +63,10 @@ public interface ComputeService {
|
||||||
Map<String, ? extends ComputeMetadata> getNodes();
|
Map<String, ? extends ComputeMetadata> getNodes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* all nodes available to the current user by id
|
* The get locations command returns all the valid locations for nodes. A location has a scope,
|
||||||
|
* which is typically region or zone. A region is a general area, like eu-west, where a zone is
|
||||||
|
* similar to a datacenter. If a location has a parent, that implies it is within that location.
|
||||||
|
* For example a location can be a rack, whose parent is likely to be a zone.
|
||||||
*/
|
*/
|
||||||
Map<String, ? extends Location> getLocations();
|
Map<String, ? extends Location> getLocations();
|
||||||
|
|
||||||
|
@ -69,13 +77,13 @@ public interface ComputeService {
|
||||||
*
|
*
|
||||||
* @param tag
|
* @param tag
|
||||||
* - common identifier to group nodes by, cannot contain hyphens
|
* - common identifier to group nodes by, cannot contain hyphens
|
||||||
* @param maxNodes
|
* @param count
|
||||||
* - how many to fire up.
|
* - how many to fire up.
|
||||||
* @param template
|
* @param template
|
||||||
* - how to configure the nodes
|
* - how to configure the nodes
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
NodeSet runNodes(String tag, int maxNodes, Template template);
|
NodeSet runNodesWithTag(String tag, int count, Template template);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* destroy the node. If it is the only node in a tag set, the dependent resources will also be
|
* destroy the node. If it is the only node in a tag set, the dependent resources will also be
|
||||||
|
@ -86,7 +94,7 @@ public interface ComputeService {
|
||||||
/**
|
/**
|
||||||
* destroy the nodes identified by this tag.
|
* destroy the nodes identified by this tag.
|
||||||
*/
|
*/
|
||||||
void destroyNodes(String tag);
|
void destroyNodesWithTag(String tag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a node by its id
|
* Find a node by its id
|
||||||
|
@ -98,6 +106,6 @@ public interface ComputeService {
|
||||||
*
|
*
|
||||||
* @param tag
|
* @param tag
|
||||||
*/
|
*/
|
||||||
NodeSet getNodes(String tag);
|
NodeSet getNodesWithTag(String tag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
@Test(enabled = true)
|
@Test(enabled = true)
|
||||||
public void testCreate() throws Exception {
|
public void testCreate() throws Exception {
|
||||||
try {
|
try {
|
||||||
client.destroyNodes(tag);
|
client.destroyNodesWithTag(tag);
|
||||||
} catch (HttpResponseException e) {
|
} catch (HttpResponseException e) {
|
||||||
// TODO hosting.com throws 400 when we try to delete a vApp
|
// TODO hosting.com throws 400 when we try to delete a vApp
|
||||||
} catch (NoSuchElementException e) {
|
} catch (NoSuchElementException e) {
|
||||||
|
@ -144,7 +144,7 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
//
|
//
|
||||||
.build(org.jclouds.scriptbuilder.domain.OsFamily.UNIX)
|
.build(org.jclouds.scriptbuilder.domain.OsFamily.UNIX)
|
||||||
.getBytes());
|
.getBytes());
|
||||||
nodes = Sets.newTreeSet(client.runNodes(tag, 2, template));
|
nodes = Sets.newTreeSet(client.runNodesWithTag(tag, 2, template));
|
||||||
assertEquals(nodes.size(), 2);
|
assertEquals(nodes.size(), 2);
|
||||||
for (NodeMetadata node : nodes) {
|
for (NodeMetadata node : nodes) {
|
||||||
assertNotNull(node.getId());
|
assertNotNull(node.getId());
|
||||||
|
@ -171,7 +171,7 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
|
|
||||||
@Test(enabled = true, dependsOnMethods = "testCreate")
|
@Test(enabled = true, dependsOnMethods = "testCreate")
|
||||||
public void testGet() throws Exception {
|
public void testGet() throws Exception {
|
||||||
NodeSet metadataSet = client.getNodes(tag);
|
NodeSet metadataSet = client.getNodesWithTag(tag);
|
||||||
for (NodeMetadata node : nodes) {
|
for (NodeMetadata node : nodes) {
|
||||||
metadataSet.remove(node);
|
metadataSet.remove(node);
|
||||||
NodeMetadata metadata = client.getNodeMetadata(node);
|
NodeMetadata metadata = client.getNodeMetadata(node);
|
||||||
|
@ -267,8 +267,8 @@ public abstract class BaseComputeServiceLiveTest {
|
||||||
@AfterTest
|
@AfterTest
|
||||||
protected void cleanup() throws InterruptedException, ExecutionException, TimeoutException {
|
protected void cleanup() throws InterruptedException, ExecutionException, TimeoutException {
|
||||||
if (nodes != null) {
|
if (nodes != null) {
|
||||||
client.destroyNodes(tag);
|
client.destroyNodesWithTag(tag);
|
||||||
for (NodeMetadata node : client.getNodes(tag)) {
|
for (NodeMetadata node : client.getNodesWithTag(tag)) {
|
||||||
assert node.getState() == NodeState.TERMINATED : node;
|
assert node.getState() == NodeState.TERMINATED : node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class CloudServersComputeService implements ComputeService {
|
||||||
.put(ServerStatus.UNKNOWN, NodeState.UNKNOWN).build();
|
.put(ServerStatus.UNKNOWN, NodeState.UNKNOWN).build();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeSet runNodes(final String tag, int max, final Template template) {
|
public NodeSet runNodesWithTag(final String tag, int max, final Template template) {
|
||||||
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
|
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
|
||||||
logger.debug(">> running server image(%s) flavor(%s)", template.getImage().getId(), template
|
logger.debug(">> running server image(%s) flavor(%s)", template.getImage().getId(), template
|
||||||
.getSize().getId());
|
.getSize().getId());
|
||||||
|
@ -251,7 +251,7 @@ public class CloudServersComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroyNodes(String tag) { // TODO parallel
|
public void destroyNodesWithTag(String tag) { // TODO parallel
|
||||||
logger.debug(">> terminating servers by tag(%s)", tag);
|
logger.debug(">> terminating servers by tag(%s)", tag);
|
||||||
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
|
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
|
||||||
for (final NodeMetadata node : doGetNodes(tag)) {
|
for (final NodeMetadata node : doGetNodes(tag)) {
|
||||||
|
@ -273,7 +273,7 @@ public class CloudServersComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeSet getNodes(String tag) {
|
public NodeSet getNodesWithTag(String tag) {
|
||||||
logger.debug(">> listing servers by tag(%s)", tag);
|
logger.debug(">> listing servers by tag(%s)", tag);
|
||||||
NodeSet nodes = doGetNodes(tag);
|
NodeSet nodes = doGetNodes(tag);
|
||||||
logger.debug("<< list(%d)", nodes.size());
|
logger.debug("<< list(%d)", nodes.size());
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class RimuHostingComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeSet runNodes(final String tag, int max, final Template template) {
|
public NodeSet runNodesWithTag(final String tag, int max, final Template template) {
|
||||||
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
|
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
|
||||||
logger.debug(">> running server image(%s) flavor(%s)", template.getImage().getId(), template
|
logger.debug(">> running server image(%s) flavor(%s)", template.getImage().getId(), template
|
||||||
.getSize().getId());
|
.getSize().getId());
|
||||||
|
@ -238,7 +238,7 @@ public class RimuHostingComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroyNodes(String tag) { // TODO parallel
|
public void destroyNodesWithTag(String tag) { // TODO parallel
|
||||||
logger.debug(">> terminating servers by tag(%s)", tag);
|
logger.debug(">> terminating servers by tag(%s)", tag);
|
||||||
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
|
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
|
||||||
for (final NodeMetadata node : doGetNodes(tag)) {
|
for (final NodeMetadata node : doGetNodes(tag)) {
|
||||||
|
@ -260,7 +260,7 @@ public class RimuHostingComputeService implements ComputeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeSet getNodes(String tag) {
|
public NodeSet getNodesWithTag(String tag) {
|
||||||
logger.debug(">> listing servers by tag(%s)", tag);
|
logger.debug(">> listing servers by tag(%s)", tag);
|
||||||
NodeSet nodes = doGetNodes(tag);
|
NodeSet nodes = doGetNodes(tag);
|
||||||
logger.debug("<< list(%d)", nodes.size());
|
logger.debug("<< list(%d)", nodes.size());
|
||||||
|
|
|
@ -192,7 +192,7 @@ public class ComputeTask extends Task {
|
||||||
|
|
||||||
Template template = createTemplateFromElement(nodeElement, computeService);
|
Template template = createTemplateFromElement(nodeElement, computeService);
|
||||||
|
|
||||||
NodeMetadata createdNode = Iterables.getOnlyElement(computeService.runNodes(tag, nodeElement
|
NodeMetadata createdNode = Iterables.getOnlyElement(computeService.runNodesWithTag(tag, nodeElement
|
||||||
.getCount(), template));
|
.getCount(), template));
|
||||||
|
|
||||||
logNodeDetails(createdNode);
|
logNodeDetails(createdNode);
|
||||||
|
@ -230,12 +230,12 @@ public class ComputeTask extends Task {
|
||||||
|
|
||||||
private void destroy(ComputeService computeService) {
|
private void destroy(ComputeService computeService) {
|
||||||
log(String.format("destroy tag: %s", nodeElement.getTag()));
|
log(String.format("destroy tag: %s", nodeElement.getTag()));
|
||||||
computeService.destroyNodes(nodeElement.getTag());
|
computeService.destroyNodesWithTag(nodeElement.getTag());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void get(ComputeService computeService) {
|
private void get(ComputeService computeService) {
|
||||||
log(String.format("get tag: %s", nodeElement.getTag()));
|
log(String.format("get tag: %s", nodeElement.getTag()));
|
||||||
for (ComputeMetadata node : computeService.getNodes(nodeElement.getTag())) {
|
for (ComputeMetadata node : computeService.getNodesWithTag(nodeElement.getTag())) {
|
||||||
logDetails(computeService, node);
|
logDetails(computeService, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,7 @@ public class VCloudComputeService implements ComputeService, VCloudComputeClient
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeSet runNodes(final String tag, int max, final Template template) {
|
public NodeSet runNodesWithTag(final String tag, int max, final Template template) {
|
||||||
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
|
checkArgument(tag.indexOf('-') == -1, "tag cannot contain hyphens");
|
||||||
checkNotNull(template.getLocation(), "location");
|
checkNotNull(template.getLocation(), "location");
|
||||||
// TODO: find next id
|
// TODO: find next id
|
||||||
|
@ -354,7 +354,7 @@ public class VCloudComputeService implements ComputeService, VCloudComputeClient
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroyNodes(String tag) { // TODO parallel
|
public void destroyNodesWithTag(String tag) { // TODO parallel
|
||||||
logger.debug(">> terminating servers by tag(%s)", tag);
|
logger.debug(">> terminating servers by tag(%s)", tag);
|
||||||
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
|
Set<ListenableFuture<Void>> responses = Sets.newHashSet();
|
||||||
for (final NodeMetadata node : doGetNodes(tag)) {
|
for (final NodeMetadata node : doGetNodes(tag)) {
|
||||||
|
@ -376,7 +376,7 @@ public class VCloudComputeService implements ComputeService, VCloudComputeClient
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NodeSet getNodes(String tag) {
|
public NodeSet getNodesWithTag(String tag) {
|
||||||
logger.debug(">> listing servers by tag(%s)", tag);
|
logger.debug(">> listing servers by tag(%s)", tag);
|
||||||
NodeSet nodes = doGetNodes(tag);
|
NodeSet nodes = doGetNodes(tag);
|
||||||
logger.debug("<< list(%d)", nodes.size());
|
logger.debug("<< list(%d)", nodes.size());
|
||||||
|
|
Loading…
Reference in New Issue