def list_allocations(self, query): hosts_id_list = [h['id'] for h in db_api.host_list()] options = self.get_query_options(query, QUERY_TYPE_ALLOCATION) hosts_allocations = self.query_allocations(hosts_id_list, **options) return [{"resource_id": host, "reservations": allocs} for host, allocs in hosts_allocations.items()]
def _filter_hosts_by_properties(self, hypervisor_properties, resource_properties): filter = [] if hypervisor_properties: filter += plugins_utils.convert_requirements(hypervisor_properties) if resource_properties: filter += plugins_utils.convert_requirements(resource_properties) if filter: return db_api.host_get_all_by_queries(filter) else: return db_api.host_list()
def list_computehosts(self, query=None): raw_host_list = db_api.host_list() host_list = [] for host in raw_host_list: host_list.append(self.get_computehost(host['id'])) return host_list