@Override
  public void removeHost(Long hostId) throws AmbariException {
    hostLock.writeLock().lock();
    try {
      Host host = m_hosts.get(hostId);
      if (null == host) {
        return;
      }

      String hostName = host.getHostName();
      LOG.info("Removing host (id={}, name={}) from config group", host.getHostId(), hostName);

      try {
        // remove the entities first, then update internal state
        removeConfigGroupHostEntity(host);
        m_hosts.remove(hostId);
      } catch (Exception e) {
        LOG.error("Failed to delete config group host mapping for cluster {} and host {}",
            cluster.getClusterName(), hostName, e);

        throw new AmbariException(e.getMessage());
      }
    } finally {
      hostLock.writeLock().unlock();
    }
  }
Helper method to recreate configs mapping
ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java