use of com.sequenceiq.cloudbreak.common.type.TemporaryStorage in project cloudbreak by hortonworks.
the class StackUtil method collectNewNodesWithDiskData.
public Set<Node> collectNewNodesWithDiskData(Stack stack, Set<String> newNodeAddresses) {
Set<Node> agents = new HashSet<>();
List<Resource> volumeSets = stack.getDiskResources();
Map<String, Map<String, Object>> instanceToVolumeInfoMap = createInstanceToVolumeInfoMap(volumeSets);
for (InstanceGroup instanceGroup : stack.getInstanceGroups()) {
if (instanceGroup.getNodeCount() != 0) {
for (InstanceMetaData im : instanceGroup.getNotDeletedAndNotZombieInstanceMetaDataSet()) {
if (im.getDiscoveryFQDN() != null && (newNodeAddresses.isEmpty() || newNodeAddresses.contains(im.getPrivateIp()))) {
String instanceId = im.getInstanceId();
String instanceType = instanceGroup.getTemplate().getInstanceType();
String dataVolumes = getOrDefault(instanceToVolumeInfoMap, instanceId, "dataVolumes", "");
String serialIds = getOrDefault(instanceToVolumeInfoMap, instanceId, "serialIds", "");
String fstab = getOrDefault(instanceToVolumeInfoMap, instanceId, "fstab", "");
String uuids = getOrDefault(instanceToVolumeInfoMap, instanceId, "uuids", "");
Integer databaseVolumeIndex = getOrDefault(instanceToVolumeInfoMap, instanceId, "dataBaseVolumeIndex", -1);
TemporaryStorage temporaryStorage = Optional.ofNullable(instanceGroup.getTemplate().getTemporaryStorage()).orElse(TemporaryStorage.ATTACHED_VOLUMES);
NodeVolumes nodeVolumes = new NodeVolumes(databaseVolumeIndex, dataVolumes, serialIds, fstab, uuids);
agents.add(new Node(im.getPrivateIp(), im.getPublicIp(), instanceId, instanceType, im.getDiscoveryFQDN(), im.getInstanceGroupName(), nodeVolumes, temporaryStorage));
}
}
}
}
return agents;
}
Aggregations