Java Code Examples for org.jclouds.compute.domain.NodeMetadata#getName()

The following examples show how to use org.jclouds.compute.domain.NodeMetadata#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NovaLauncher.java    From karamel with Apache License 2.0 6 votes vote down vote up
private List<String> findLeftVmNames(Set<? extends NodeMetadata> successfulNodes, List<String> vmNames) {
  List<String> leftVmNames = new ArrayList<>();
  leftVmNames.addAll(vmNames);
  int unnamedVms = 0;
  for (NodeMetadata nodeMetadata : successfulNodes) {
    String nodeName = nodeMetadata.getName();
    if (leftVmNames.contains(nodeName)) {
      leftVmNames.remove(nodeName);
    } else {
      unnamedVms++;
    }
  }

  for (int i = 0; i < unnamedVms; i++) {
    if (leftVmNames.size() > 0) {
      logger.debug(String.format("Taking %s as one of the unnamed vms.", leftVmNames.get(0)));
      leftVmNames.remove(0);
    }
  }
  return leftVmNames;
}
 
Example 2
Source File: NovaLauncher.java    From karamel with Apache License 2.0 6 votes vote down vote up
public static Predicate<NodeMetadata> withPredicate(final Set<String> ids, final Set<String> names,
                                                    final Set<String> groupNames) {
  return new Predicate<NodeMetadata>() {
    @Override
    public boolean apply(NodeMetadata nodeMetadata) {
      String id = nodeMetadata.getId();
      String name = nodeMetadata.getName();
      String group = nodeMetadata.getGroup();
      return ((id != null && ids.contains(id)) || (name != null && names.contains(name) ||
              (group != null && groupNames.contains(group))));
    }

    @Override
    public String toString() {
      return "machines predicate";
    }
  };
}
 
Example 3
Source File: NovaV3Launcher.java    From karamel with Apache License 2.0 6 votes vote down vote up
public static Predicate<NodeMetadata> withPredicate(final Set<String> ids, final Set<String> names,
                                                    final Set<String> groupNames) {
  return new Predicate<NodeMetadata>() {
    @Override
    public boolean apply(NodeMetadata nodeMetadata) {
      String id = nodeMetadata.getId();
      String name = nodeMetadata.getName();
      String group = nodeMetadata.getGroup();
      return ((id != null && ids.contains(id)) || (name != null && names.contains(name) ||
              (group != null && groupNames.contains(group))));
    }

    @Override
    public String toString() {
      return "machines predicate";
    }
  };
}
 
Example 4
Source File: Ec2Launcher.java    From karamel with Apache License 2.0 6 votes vote down vote up
private List<String> findLeftVmNames(Set<? extends NodeMetadata> successfulNodes, List<String> vmNames) {
  List<String> leftVmNames = new ArrayList<>();
  leftVmNames.addAll(vmNames);
  int unnamedVms = 0;
  for (NodeMetadata nodeMetadata : successfulNodes) {
    String nodeName = nodeMetadata.getName();
    if (leftVmNames.contains(nodeName)) {
      leftVmNames.remove(nodeName);
    } else {
      unnamedVms++;
    }
  }

  for (int i = 0; i < unnamedVms; i++) {
    if (leftVmNames.size() > 0) {
      logger.debug(String.format("Taking %s as one of the unnamed vms.", leftVmNames.get(0)));
      leftVmNames.remove(0);
    }
  }
  return leftVmNames;
}
 
Example 5
Source File: Ec2Launcher.java    From karamel with Apache License 2.0 6 votes vote down vote up
public static Predicate<NodeMetadata> withPredicate(final Set<String> ids, final Set<String> names,
    final Set<String> groupNames) {
  return new Predicate<NodeMetadata>() {
    @Override
    public boolean apply(NodeMetadata nodeMetadata) {
      String id = nodeMetadata.getId();
      String name = nodeMetadata.getName();
      String group = nodeMetadata.getGroup();
      return ((id != null && ids.contains(id)) || (name != null && names.contains(name)
          || (group != null && groupNames.contains(group))));
    }

    @Override
    public String toString() {
      return "machines predicate";
    }
  };
}
 
Example 6
Source File: OpenStackModule.java    From cloudml with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void exec() {
    List<MonitoredVm> list = new ArrayList<MonitoredVm>();
    //get all servers
    Set<NodeMetadata> jCloudsNodes = (Set<NodeMetadata>) connector.listOfVMs();
    Iterator<NodeMetadata> iterator = jCloudsNodes.iterator();
    while (iterator.hasNext()) {
        NodeMetadata current = iterator.next();
        String name = (current.getName());
        MonitoredVm temp = new MonitoredVm(current.getId(), name, toState(current.getStatus()));
        list.add(temp);
    }
    ListManager.listManager(list, VMs, coord);
}
 
Example 7
Source File: JCloudsModule.java    From cloudml with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void exec() {
    List<MonitoredVm> list = new ArrayList<MonitoredVm>();
    //get all servers
    Set<NodeMetadata> jCloudsNodes = (Set<NodeMetadata>) connector.listOfVMs();
    Iterator<NodeMetadata> iterator = jCloudsNodes.iterator();
    while (iterator.hasNext()) {
        NodeMetadata current = iterator.next();
        String name = (current.getName());
        MonitoredVm temp = new MonitoredVm(current.getId(), name, toState(current.getStatus()));
        list.add(temp);
    }
    ListManager.listManager(list, VMs, coord);

}
 
Example 8
Source File: CloudDistributedTLCJob.java    From tlaplus with MIT License 4 votes vote down vote up
public WrapperNodeMetadata(final NodeMetadata m, final LoginCredentials credentials) {
	super(m.getProviderId(), m.getName(), m.getId(), m.getLocation(), m.getUri(), m.getUserMetadata(),
			m.getTags(), m.getGroup(), m.getHardware(), m.getImageId(), m.getOperatingSystem(), m.getStatus(),
			m.getBackendStatus(), m.getLoginPort(), m.getPublicAddresses(), m.getPrivateAddresses(),
			credentials, m.getHostname());
}