def _schedule(self, context, topic, request_spec, *args, **kwargs):
        if topic != "compute":
            msg = _("Scheduler only understands Compute nodes (for now)")
            raise NotImplementedError(msg)

        # Get all available hosts.
        all_hosts = self.zone_manager.service_states.iteritems()
        unfiltered_hosts = [(host, services[topic])
                for host, services in all_hosts
                if topic in services]

        # Filter local hosts based on requirements ...
        filtered_hosts = self.filter_hosts(topic, request_spec,
                unfiltered_hosts)

        # weigh the selected hosts.
        # weighted_hosts = [{weight=weight, hostname=hostname,
        #         capabilities=capabs}, ...]
        weighted_hosts = self.weigh_hosts(topic, request_spec, filtered_hosts)
        # Next, tack on the host weights from the child zones
        json_spec = json.dumps(request_spec)
        all_zones = db.zone_get_all(context)
        child_results = self._call_zone_method(context, "select",
                specs=json_spec, zones=all_zones)
        self._adjust_child_weights(child_results, all_zones)
        for child_zone, result in child_results:
            for weighting in result:
                # Remember the child_zone so we can get back to
                # it later if needed. This implicitly builds a zone
                # path structure.
                host_dict = {"weight": weighting["weight"],
                        "child_zone": child_zone,
                        "child_blob": weighting["blob"]}
                weighted_hosts.append(host_dict)
        weighted_hosts.sort(key=operator.itemgetter('weight'))
        return weighted_hosts
Returns a list of hosts that meet the required specs,
dataset/ETHPy150Open nii-cloud/dodai-compute/nova/scheduler/abstract_scheduler.py/AbstractScheduler._schedule