class ClusterResourcesService {

    public ClusterResourcesAvailableToStart createClusterResourcesAvailableToStart(long clusterId, String clusterName, List<HostResources> hostsToStart) {
        long clusterCpuSpeed = 0, clusterMemory = 0;
        int clusterCpus = 0;
        for (HostResources currentHost : hostsToStart) {
            clusterMemory += currentHost.getTotalMemoryInBytes();
            clusterCpuSpeed += currentHost.getSpeed();
            clusterCpus += currentHost.getCpus();
        }

        return new ClusterResourcesAvailableToStart(clusterId, clusterName, clusterCpuSpeed, clusterCpus, clusterMemory, hostsToStart);
    }

}