private void selectReservation(ReservationTaskState state, LinkedHashMap<String, String> resourcePoolsPerGroupPlacementLinks) { if (resourcePoolsPerGroupPlacementLinks.isEmpty()) { failTask("No suitable host available", null); return; } Iterator<String> iter = resourcePoolsPerGroupPlacementLinks.keySet().iterator(); String placementLink = iter.next(); iter.remove(); logInfo("Current selected placement: %s", placementLink); proceedTo(SubStage.RESERVATION_SELECTED, s -> { s.resourcePoolsPerGroupPlacementLinks = resourcePoolsPerGroupPlacementLinks; s.groupResourcePlacementLink = placementLink; }); }
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); }
logInfo("Placements found: [%s] with available instances: [%s] and available memory:" + " [%s].", placement.documentSelfLink, placement.availableInstancesCount,
reservationRequest.referer = getSelfLink(); logInfo("Reserving instances: %d for descLink: %s and groupPlacementId: %s", reservationRequest.resourceCount, reservationRequest.resourceDescriptionLink, Service.getId(placementLink));
logInfo("Querying for global placements for resource description: [%s] and resource" + " count: [%s]..", state.resourceDescriptionLink, state.resourceCount); q.querySpec.query.addBooleanClause(tenantLinksQuery); } else { logInfo("Querying for group [%s] placements for resource description: [%s] and resource" + " count: [%s]...", state.tenantLinks, state.resourceDescriptionLink, state.resourceCount); logInfo("Placement query includes memory limit of: [%s]", memoryLimit);