def detail(self, req): """Implements the HTTP GET for the /storage-providers/detail URI""" providers = [] context = req.environ['cinder.context'] context = self._validate_authorization(context, 'index') #Retrieve all of the Storage Nodes from the Database storage_nodes = paxes_db_api.storage_node_get_all(context) #Return all of the details for each of the Storage Nodes found for storage_node in storage_nodes: providers.append(self._parse_storage_provider(storage_node)) return {'storage_providers': providers}
def index(self, req): """Implements the HTTP GET for the /storage-providers URI""" providers = [] context = req.environ['cinder.context'] context = self._validate_authorization(context, 'index') #Retrieve all of the Storage Nodes from the Database storage_nodes = paxes_db_api.storage_node_get_all(context) for node in storage_nodes: provider = self._parse_storage_provider(node) hostname = provider['storage_hostname'] #We only want to return the Id and Host-name from Index providers.append({'id': provider['id'], 'storage_hostname': hostname}) return {'storage_providers': providers}