private void hostsSelected(ReservationTaskState state) {
if (state.hostSelections == null || state.hostSelections.isEmpty()) {
if (state.tenantLinks != null && !state.tenantLinks.isEmpty()) {
proceedTo(SubStage.QUERYING_GLOBAL);
} else {
failTask("Available compute host can't be selected.", null);
}
return;
}
logInfo("Hosts selected %s", state.hostSelections);
final Set<String> resourcePools = new HashSet<>();
state.hostSelections.forEach(hs -> resourcePools.addAll(hs.resourcePoolLinks));
if (state.resourcePoolsPerGroupPlacementLinks != null) {
state.resourcePoolsPerGroupPlacementLinks = state.resourcePoolsPerGroupPlacementLinks
.entrySet().stream().filter((e) -> resourcePools.contains(e.getValue()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue,
(k1, k2) -> k1, LinkedHashMap::new));
} else {
state.resourcePoolsPerGroupPlacementLinks = new LinkedHashMap<>();
}
selectReservation(state, state.resourcePoolsPerGroupPlacementLinks);
}