'Returns a list of groups through view builder.'

def _get_groups(self, req, is_detail):

    context = req.environ['cinder.context']
    filters = req.params.copy()
    api_version = req.api_version_request
    (marker, limit, offset) = common.get_pagination_params(filters)
    (sort_keys, sort_dirs) = common.get_sort_params(filters)
    filters.pop('list_volume', None)
    if api_version.matches(common.FILTERING_VERSION):
        support_like = (True if api_version.matches(common.LIKE_FILTER_VERSION) else False)
        common.reject_invalid_filters(context, filters, 'group', support_like)
    groups = self.group_api.get_all(context, filters=filters, marker=marker, limit=limit, offset=offset, sort_keys=sort_keys, sort_dirs=sort_dirs)
    new_groups = []
    for grp in groups:
        try:
            self._check_default_cgsnapshot_type(grp.group_type_id)
            new_groups.append(grp)
        except exc.HTTPBadRequest:
            pass
    if is_detail:
        groups = self._view_builder.detail_list(req, new_groups)
    else:
        groups = self._view_builder.summary_list(req, new_groups)
    return groups
