use of org.jclouds.compute.domain.ComputeMetadata in project SimianArmy by Netflix.
the class AWSClient method getJcloudsNode.
private NodeMetadata getJcloudsNode(ComputeService computeService, String jcloudsId) {
// Work around a jclouds bug / documentation issue...
// TODO: Figure out what's broken, and eliminate this function
// This should work (?):
// Set<NodeMetadata> nodes = computeService.listNodesByIds(Collections.singletonList(jcloudsId));
Set<NodeMetadata> nodes = Sets.newHashSet();
for (ComputeMetadata n : computeService.listNodes()) {
if (jcloudsId.equals(n.getId())) {
nodes.add((NodeMetadata) n);
}
}
if (nodes.isEmpty()) {
LOGGER.warn("Unable to find jclouds node: {}", jcloudsId);
for (ComputeMetadata n : computeService.listNodes()) {
LOGGER.info("Did find node: {}", n);
}
throw new IllegalStateException("Unable to find node using jclouds: " + jcloudsId);
}
NodeMetadata node = Iterables.getOnlyElement(nodes);
return node;
}
use of org.jclouds.compute.domain.ComputeMetadata in project acceptance-test-harness by jenkinsci.
the class JcloudsMachineProvider method getRunningInstances.
private Set<NodeMetadata> getRunningInstances() {
logger.info(String.format("Check if we already got running machines in the security group: %s... ", getGroupName()));
Set<? extends NodeMetadata> nodeMetadatas = computeService.listNodesDetailsMatching(new Predicate<ComputeMetadata>() {
@Override
public boolean apply(ComputeMetadata computeMetadata) {
return true;
}
});
Set<NodeMetadata> filteredNodes = new HashSet<>();
for (NodeMetadata nm : nodeMetadatas) {
if (getGroupName().equals(nm.getGroup()) && nm.getStatus() == NodeMetadata.Status.RUNNING) {
logger.info(String.format("Found running machine: %s", getGroupName()));
filteredNodes.add(nm);
}
}
return filteredNodes;
}
Aggregations