'Called from the filter scheduler, in a template pattern.'

def _get_all_host_states(self, context, spec_obj, provider_summaries):

    if (self.all_host_states is None):
        self.all_host_states = self._get_up_hosts(context)
    if (spec_obj and ('requested_destination' in spec_obj) and spec_obj.requested_destination and ('cell' in spec_obj.requested_destination)):
        only_cell = spec_obj.requested_destination.cell
    else:
        only_cell = None
    if only_cell:
        return self.all_host_states.get(only_cell.uuid, [])
    else:
        return itertools.chain.from_iterable(self.all_host_states.values())
