/** {@inheritDoc} */ @Override public Collection<InetSocketAddress> getRegisteredAddresses() throws IgniteSpiException { initComputeService(); Collection<InetSocketAddress> addresses = new LinkedList<>(); try { Set<NodeMetadata> nodes; if (nodesFilter != null) nodes = (Set<NodeMetadata>)computeService.listNodesDetailsMatching(nodesFilter); else { nodes = new HashSet<>(); for (ComputeMetadata metadata : computeService.listNodes()) nodes.add(computeService.getNodeMetadata(metadata.getId())); } for (NodeMetadata metadata : nodes) { if (metadata.getStatus() != NodeMetadata.Status.RUNNING) continue; for (String addr : metadata.getPrivateAddresses()) addresses.add(new InetSocketAddress(addr, 0)); for (String addr : metadata.getPublicAddresses()) addresses.add(new InetSocketAddress(addr, 0)); } } catch (Exception e) { throw new IgniteSpiException("Failed to get registered addresses for the provider: " + provider, e); } return addresses; }
/** * all nodes available to the current user by id. If possible, the returned set will include * {@link org.jclouds.compute.domain.NodeMetadata} objects. */ @Override public Set<? extends ComputeMetadata> listNodes() { return computeService.listNodes(); }
/** * all nodes available to the current user by id. If possible, the returned set will include * {@link org.jclouds.compute.domain.NodeMetadata} objects. */ @Override public Set<? extends ComputeMetadata> listNodes() { return computeService.listNodes(); }
@Override public Set<? extends NodeMetadata> getNodes(ClusterSpec clusterSpec) throws IOException, InterruptedException { ComputeServiceContext computeServiceContext = getCompute().apply(clusterSpec); ComputeService computeService = computeServiceContext.getComputeService(); return computeService.listNodesDetailsMatching(Predicates.in(computeService.listNodes())); } }
/** * retrieve the list of nodes * @return a list of information about each node */ public Set<? extends ComputeMetadata> listOfNodes(){ return compute.listNodes(); }
@Override public Set<? extends NodeMetadata> getNodes(ClusterSpec clusterSpec) throws IOException, InterruptedException { ComputeServiceContext computeServiceContext = getCompute().apply(clusterSpec); ComputeService computeService = computeServiceContext.getComputeService(); return computeService.listNodesDetailsMatching(Predicates.in(computeService.listNodes())); } }
/** * retrieve the list of VMs * @return a list of information about each VM */ public Set<? extends ComputeMetadata> listOfVMs(){ return compute.listNodes(); }
@Override protected void doCall(ComputeService computeService, String indent) throws Exception { Set<? extends ComputeMetadata> instances = computeService.listNodes(); stdout.println(indent+"Instances {"); for (ComputeMetadata instance : instances) { stdout.println(indent+"\t"+instance); } stdout.println(indent+"}"); } }
public Set<? extends ComputeMetadata> listNodes(Map<?,?> flags) { return getComputeService(flags).listNodes(); }
/** * Retrieve information about a node * @param name name of a node * @return data about a node */ public ComputeMetadata getNodeByName(String name){ for(ComputeMetadata n : compute.listNodes()){ if(n.getName() != null && n.getName().equals(name)) return n; } return null; }
public ComputeMetadata getVMByName(String name){ for(ComputeMetadata n : compute.listNodes()){ if(n.getName() != null && n.getName().equals(name)) return n; } return null; }
/** * Retrieve information about a VM * @param name name of a VM * @return data about a VM */ public ComputeMetadata getVMByName(String name){ for(ComputeMetadata n : novaComputeService.listNodes()){ if(n.getName() != null && n.getName().equals(name)) return n; } return null; }
/** * Retrieve information about a VM * @param name name of a VM * @return data about a VM */ public ComputeMetadata getVMByName(String name){ for(ComputeMetadata n : compute.listNodes()){ if(n.getName() != null && n.getName().equals(name)) return n; } return null; }
private void listDetails(ComputeService computeService) { log("list details"); for (ComputeMetadata node : computeService.listNodes()) {// TODO // parallel logDetails(computeService, node); } }
private void list(ComputeService computeService) { log("list"); for (ComputeMetadata node : computeService.listNodes()) { log(String.format(" location=%s, id=%s, group=%s", node.getLocation(), node.getProviderId(), node.getName())); } }
private NodeMetadata getNodeMetadataForRunningNodeWithTag(String tag) { for (ComputeMetadata node : m_computeServiceContext.getComputeService().listNodes()) { NodeMetadata candidate = m_computeServiceContext.getComputeService().getNodeMetadata(node.getId()); if (tag.equals(candidate.getGroup()) && candidate.getState().equals(NodeState.RUNNING)) { return candidate; } } return null; }
@Test(enabled = true, dependsOnMethods = "testSuspendResume") public void testListNodes() throws Exception { for (ComputeMetadata node : client.listNodes()) { assert node.getProviderId() != null : node; assert node.getLocation() != null : node; assertEquals(node.getType(), ComputeType.NODE); } }
@Test(enabled = true, dependsOnMethods = "testSuspendResume") public void testListNodes() throws Exception { for (ComputeMetadata node : client.listNodes()) { assert node.getProviderId() != null : node; assert node.getLocation() != null : node; assertEquals(node.getType(), ComputeType.NODE); } }
public void testListServersWhenReponseIs404IsEmpty() throws Exception { HttpRequest listServers = HttpRequest .builder() .method("GET") .endpoint("https://az-1.region-a.geo-1.compute.hpcloudsvc.com/v1.1/3456/servers/detail") .addHeader("Accept", "application/json") .addHeader("X-Auth-Token", authToken).build(); HttpResponse listServersResponse = HttpResponse.builder().statusCode(404).build(); ComputeService apiWhenNoServersExist = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, listServers, listServersResponse); assertTrue(apiWhenNoServersExist.listNodes().isEmpty()); }
@Test public void testAndExperiment() { ComputeServiceContext context = null; try { context = ContextBuilder.newBuilder(new ServerManagerApiMetadata()).build(ComputeServiceContext.class); context.getComputeService().listNodes(); } finally { if (context != null) context.close(); } }