private void removeHostFromClusterTopology(Clusters clusters, HostRequest hostRequest) throws AmbariException{
    if (hostRequest.getClusterName() == null) {
      for (Cluster c : clusters.getClusters().values()) {
        removeHostFromClusterTopology(c.getClusterId(), hostRequest.getHostname());
      }
    } else {
      long clusterId = clusters.getCluster(hostRequest.getClusterName()).getClusterId();
      removeHostFromClusterTopology(clusterId, hostRequest.getHostname());
    }
  }
Removes hostname from the stateful cluster topology
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java