Search in sources :

Example 1 with NodeVolumes

use of com.sequenceiq.cloudbreak.common.orchestration.NodeVolumes in project cloudbreak by hortonworks.

the class SaltOrchestrator method formatDisks.

private String formatDisks(String platformVariant, SaltConnector sc, Node node, Glob hostname) {
    NodeVolumes nodeVolumes = node.getNodeVolumes();
    if (StringUtils.isNotEmpty(nodeVolumes.getFstab())) {
        return nodeVolumes.getUuids();
    }
    String dataVolumes = String.join(" ", nodeVolumes.getDataVolumes());
    String serialIds = String.join(" ", nodeVolumes.getSerialIds());
    String formatCommandParams = "CLOUD_PLATFORM='" + platformVariant + "' ATTACHED_VOLUME_NAME_LIST='" + dataVolumes + "' ATTACHED_VOLUME_SERIAL_LIST='" + serialIds + "' ";
    String command = "(cd " + SRV_SALT_DISK + ';' + formatCommandParams + "./" + DISK_FORMAT + ')';
    Map<String, String> formatResponse = SaltStates.runCommandOnHosts(retry, sc, hostname, command);
    return formatResponse.getOrDefault(node.getHostname(), "");
}
Also used : NodeVolumes(com.sequenceiq.cloudbreak.common.orchestration.NodeVolumes)

Example 2 with NodeVolumes

use of com.sequenceiq.cloudbreak.common.orchestration.NodeVolumes 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;
}
Also used : Node(com.sequenceiq.cloudbreak.common.orchestration.Node) Resource(com.sequenceiq.cloudbreak.domain.Resource) InstanceGroup(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup) InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) NodeVolumes(com.sequenceiq.cloudbreak.common.orchestration.NodeVolumes) TemporaryStorage(com.sequenceiq.cloudbreak.common.type.TemporaryStorage) Map(java.util.Map) HashSet(java.util.HashSet)

Aggregations

NodeVolumes (com.sequenceiq.cloudbreak.common.orchestration.NodeVolumes)2 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)1 TemporaryStorage (com.sequenceiq.cloudbreak.common.type.TemporaryStorage)1 Resource (com.sequenceiq.cloudbreak.domain.Resource)1 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)1 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1