@Override
  public void mapAndPublishHostsToCluster(Set<String> hostnames, String clusterName) throws AmbariException {
    for (String hostname : hostnames) {
      mapHostToCluster(hostname, clusterName);
    }
    publishAddingHostsToCluster(hostnames, clusterName);
    getCluster(clusterName).refresh();
  }
For each host, attempts to map it to the cluster, and apply the cluster's current version to the host.
@param hostnames Collection of host names
@param clusterName Cluster name
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java