def _get_replicas(self, req, is_detail=False): """Returns list of replicas.""" context = req.environ['manila.context'] share_id = req.params.get('share_id') if share_id: try: replicas = db.share_replicas_get_all_by_share( context, share_id) except exception.NotFound: msg = _("Share with share ID %s not found.") % share_id raise exc.HTTPNotFound(explanation=msg) else: replicas = db.share_replicas_get_all(context) limited_list = common.limited(replicas, req) if is_detail: replicas = self._view_builder.detail_list(req, limited_list) else: replicas = self._view_builder.summary_list(req, limited_list) return replicas