@Override
  public void deleteCluster(String clusterName)
      throws AmbariException {
    Cluster cluster = getCluster(clusterName);
    if (!cluster.canBeRemoved()) {
      throw new AmbariException("Could not delete cluster" + ", clusterName=" + clusterName);
    }

    LOG.info("Deleting cluster " + cluster.getClusterName());
    cluster.delete();

    // clear maps
    for (Set<Cluster> clusterSet : getHostClustersMap().values()) {
      clusterSet.remove(cluster);
    }
    getClusterHostsMap().remove(cluster.getClusterName());
    getClustersByName().remove(clusterName);
  }
Attempts to map the host to the cluster via clusterhostmapping table if not already present, and add a host_version
record for the cluster's currently applied (stack, version) if not already present.
@param hostname Host name
@param clusterName Cluster name
@throws AmbariException May throw a DuplicateResourceException.
ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java