'Returns a list of volumes, transformed through view builder.'

def _get_volumes(self, req, is_detail):

    context = req.environ['cinder.context']
    params = req.params.copy()
    (marker, limit, offset) = common.get_pagination_params(params)
    (sort_keys, sort_dirs) = common.get_sort_params(params)
    filters = params
    filters.pop('glance_metadata', None)
    utils.remove_invalid_filter_options(context, filters, self._get_volume_filter_options())
    if ('name' in sort_keys):
        sort_keys[sort_keys.index('name')] = 'display_name'
    if ('name' in filters):
        filters['display_name'] = filters.pop('name')
    self.volume_api.check_volume_filters(filters)
    volumes = self.volume_api.get_all(context, marker, limit, sort_keys=sort_keys, sort_dirs=sort_dirs, filters=filters, viewable_admin_meta=True, offset=offset)
    for volume in volumes:
        utils.add_visible_admin_metadata(volume)
    req.cache_db_volumes(volumes.objects)
    if is_detail:
        volumes = self._view_builder.detail_list(req, volumes)
    else:
        volumes = self._view_builder.summary_list(req, volumes)
    return volumes
