use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class ClusterContainerRunner method getGatewayPrivateIp.
private String getGatewayPrivateIp(Stack stack) {
String gatewayHostname = "";
if (stack.getInstanceGroups() != null && !stack.getInstanceGroups().isEmpty()) {
InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance();
gatewayHostname = gatewayInstance.getPrivateIp();
}
return gatewayHostname;
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class ClusterContainerRunner method getGatewayHostName.
private String getGatewayHostName(Stack stack) {
String gatewayHostname = "";
if (stack.getInstanceGroups() != null && !stack.getInstanceGroups().isEmpty()) {
if (stack.getPrimaryGatewayInstance() != null) {
InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance();
gatewayHostname = gatewayInstance.getDiscoveryFQDN();
}
}
return gatewayHostname;
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class ContainerConstraintFactory method collectUpscaleCandidates.
private List<String> collectUpscaleCandidates(Long clusterId, String hostGroupName, Integer adjustment) {
HostGroup hostGroup = hostGroupRepository.findHostGroupInClusterByName(clusterId, hostGroupName);
if (hostGroup.getConstraint().getInstanceGroup() != null) {
Long instanceGroupId = hostGroup.getConstraint().getInstanceGroup().getId();
Set<InstanceMetaData> unusedHostsInInstanceGroup = instanceMetaDataRepository.findUnusedHostsInInstanceGroup(instanceGroupId);
List<String> hostNames = new ArrayList<>();
for (InstanceMetaData instanceMetaData : unusedHostsInInstanceGroup) {
hostNames.add(instanceMetaData.getDiscoveryFQDN());
if (hostNames.size() >= adjustment) {
break;
}
}
return hostNames;
}
return null;
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method getFirstValidPrivateId.
private Long getFirstValidPrivateId(Iterable<InstanceGroup> instanceGroups) {
LOGGER.info("Get first valid PrivateId of instanceGroups");
long highest = 0;
for (InstanceGroup instanceGroup : instanceGroups) {
LOGGER.info("Checking of instanceGroup: {}", instanceGroup.getGroupName());
for (InstanceMetaData metaData : instanceGroup.getAllInstanceMetaData()) {
Long privateId = metaData.getPrivateId();
LOGGER.info("InstanceMetaData metaData: privateId: {}, instanceGroupName: {}, instanceId: {}, status: {}", privateId, metaData.getInstanceGroupName(), metaData.getInstanceId(), metaData.getInstanceStatus());
if (privateId == null) {
continue;
}
if (privateId > highest) {
highest = privateId;
}
}
}
LOGGER.info("highest privateId: {}", highest);
return highest == 0 ? 0 : highest + 1;
}
use of com.sequenceiq.cloudbreak.domain.InstanceMetaData in project cloudbreak by hortonworks.
the class InstanceMetadataService method updateInstanceStatus.
public void updateInstanceStatus(Iterable<InstanceGroup> instanceGroup, com.sequenceiq.cloudbreak.api.model.InstanceStatus newStatus, Collection<String> candidateAddresses) {
for (InstanceGroup group : instanceGroup) {
for (InstanceMetaData instanceMetaData : group.getInstanceMetaData()) {
if (candidateAddresses.contains(instanceMetaData.getDiscoveryFQDN())) {
instanceMetaData.setInstanceStatus(newStatus);
instanceMetaDataRepository.save(instanceMetaData);
}
}
}
}
Aggregations