public Collection<HostRequest> removePendingHostRequests(String hostGroupName) {
    Collection<HostRequest> pendingHostRequests = new ArrayList<>();
    for(HostRequest hostRequest : outstandingHostRequests) {
      if(hostGroupName == null || hostRequest.getHostgroupName().equals(hostGroupName)) {
        pendingHostRequests.add(hostRequest);
      }
    }
    if (hostGroupName == null) {
      outstandingHostRequests.clear();
    } else {
      outstandingHostRequests.removeAll(pendingHostRequests);
    }

    Collection<String> pendingReservedHostNames = new ArrayList<>();
    for(String reservedHostName : requestsWithReservedHosts.keySet()) {
      HostRequest hostRequest = requestsWithReservedHosts.get(reservedHostName);
      if(hostGroupName == null || hostRequest.getHostgroupName().equals(hostGroupName)) {
        pendingHostRequests.add(hostRequest);
        pendingReservedHostNames.add(reservedHostName);
      }
    }
    requestsWithReservedHosts.keySet().removeAll(pendingReservedHostNames);

    allHostRequests.removeAll(pendingHostRequests);
    return pendingHostRequests;
  }
Removes pending host requests (outstanding requests not picked up by any host, where hostName is null) for a host group.
@param hostGroupName
@return
ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java