use of io.fabric8.internal.autoscale.LoadSortedHostConfiguration in project fabric8 by jboss-fuse.
the class SshAutoScaler method chooseHostContainerOptions.
/**
* This method is public for easier testing
*/
public static CreateSshContainerOptions.Builder chooseHostContainerOptions(AutoScaleRequest request, HostProfileCounter hostProfileCounter) {
CreateSshContainerOptions.Builder builder = CreateSshContainerOptions.builder();
FabricRequirements requirements = request.getFabricRequirements();
ProfileRequirements profileRequirements = request.getProfileRequirements();
SshScalingRequirements sshScalingRequirements = profileRequirements.getSshScalingRequirements();
List<SshHostConfiguration> hosts = requirements.getSshHosts();
SortedSet<LoadSortedHostConfiguration<SshHostConfiguration>> sortedHostConfigurations = AutoScalers.filterHosts(profileRequirements, sshScalingRequirements, hostProfileCounter, hosts);
SshHostConfiguration sshHostConfig = null;
if (!sortedHostConfigurations.isEmpty()) {
LoadSortedHostConfiguration<SshHostConfiguration> first = sortedHostConfigurations.first();
sshHostConfig = first.getConfiguration();
}
if (sshHostConfig == null) {
LOG.warn("Could not create version " + request.getVersion() + " profile " + request.getProfile() + " as no matching hosts could be found for " + sshScalingRequirements);
request.getProfileAutoScaleStatus().noSuitableHost("" + sshScalingRequirements);
return null;
}
builder.configure(sshHostConfig, requirements, profileRequirements);
return builder;
}
Aggregations