'Returns a sorted list of HostState objects that satisfy the
supplied request_spec.
These hosts will have already had their resources claimed in Placement.
:param context: The RequestContext object
:param spec_obj: The RequestSpec object
:param instance_uuids: List of UUIDs, one for each value of the spec
object\'s num_instances attribute
:param alloc_reqs_by_rp_uuid: Optional dict, keyed by resource provider
UUID, of the allocation requests that may
be used to claim resources against
matched hosts. If None, indicates either
the placement API wasn\'t reachable or
that there were no allocation requests
returned by the placement API. If the
latter, the provider_summaries will be an
empty dict, not None.
:param provider_summaries: Optional dict, keyed by resource provider
UUID, of information that will be used by
the filters/weighers in selecting matching
hosts for a request. If None, indicates that
the scheduler driver should grab all compute
node information locally and that the
Placement API is not used. If an empty dict,
indicates the Placement API returned no
potential matches for the requested
resources.'

def select_destinations(self, context, spec_obj, instance_uuids, alloc_reqs_by_rp_uuid, provider_summaries):

    self.notifier.info(context, 'scheduler.select_destinations.start', dict(request_spec=spec_obj.to_legacy_request_spec_dict()))
    num_instances = spec_obj.num_instances
    selected_hosts = self._schedule(context, spec_obj, instance_uuids, alloc_reqs_by_rp_uuid, provider_summaries)
    if (len(selected_hosts) < num_instances):
        for host in selected_hosts:
            host.updated = None
        LOG.debug('There    are    %(hosts)d    hosts    available    but    %(num_instances)d    instances    requested    to    build.', {'hosts': len(selected_hosts), 'num_instances': num_instances})
        reason = _('There    are    not    enough    hosts    available.')
        raise exception.NoValidHost(reason=reason)
    self.notifier.info(context, 'scheduler.select_destinations.end', dict(request_spec=spec_obj.to_legacy_request_spec_dict()))
    return selected_hosts
