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(), "");
}
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;
}
Aggregations