private boolean areHostGroupsResolved(Collection<String> requiredHostGroups) {
    boolean allHostGroupsResolved = true;
    Map<String, HostGroupInfo> hostGroupInfo = topology.getHostGroupInfo();
    for (String hostGroup : requiredHostGroups) {
      HostGroupInfo groupInfo = hostGroupInfo.get(hostGroup);
      if (groupInfo == null) {
        allHostGroupsResolved = false;
        if (missingHostGroups.add(hostGroup)) {
          LOG.warn("Host group '{}' is missing from cluster creation request", hostGroup);
        }
      } else {
        int actualHostCount = groupInfo.getHostNames().size();
        int requestedHostCount = groupInfo.getRequestedHostCount();
        boolean hostGroupReady = actualHostCount >= requestedHostCount;
        allHostGroupsResolved &= hostGroupReady;

        Integer previousHostCount = previousHostCounts.put(hostGroup, actualHostCount);
        if (previousHostCount == null || previousHostCount != actualHostCount) {
          if (hostGroupReady) {
            LOG.info("Host group '{}' resolved, requires {} hosts and {} are available",
              groupInfo.getHostGroupName(), requestedHostCount, actualHostCount
            );
          } else {
            LOG.info("Host group '{}' pending, requires {} hosts, but only {} are available",
              groupInfo.getHostGroupName(), requestedHostCount, actualHostCount
            );
          }
        }
      }
    }

    return allHostGroupsResolved;
  }
Determine if all hosts for the given set of required host groups are known.

@param requiredHostGroups set of required host groups
@return true if all required host groups are resolved
ambari-server/src/main/java/org/apache/ambari/server/topology/tasks/ConfigureClusterTask.java