Пример #1
0
    def _items(self, req, entity_maker):
        """Returns a list of snapshots, transformed through entity_maker."""
        context = req.environ['cinder.context']

        search_opts = {}
        search_opts.update(req.GET)
        allowed_search_options = ('status', 'volume_id', 'display_name')
        volumes.remove_invalid_options(context, search_opts,
                                       allowed_search_options)

        snapshots = self.volume_api.get_all_snapshots(context,
                                                      search_opts=search_opts)
        limited_list = common.limited(snapshots, req)
        res = [entity_maker(context, snapshot) for snapshot in limited_list]
        return {'snapshots': res}
Пример #2
0
    def _items(self, req, entity_maker):
        """Returns a list of snapshots, transformed through entity_maker."""
        context = req.environ['cinder.context']

        search_opts = {}
        search_opts.update(req.GET)
        allowed_search_options = ('status', 'volume_id', 'display_name')
        volumes.remove_invalid_options(context, search_opts,
                                       allowed_search_options)

        snapshots = self.volume_api.get_all_snapshots(context,
                                                      search_opts=search_opts)
        limited_list = common.limited(snapshots, req)
        res = [entity_maker(context, snapshot) for snapshot in limited_list]
        return {'snapshots': res}
Пример #3
0
    def _items(self, req, entity_maker):
        """Returns a list of snapshots, transformed through entity_maker."""
        context = req.environ['cinder.context']

        #pop out limit and offset , they are not search_opts
        search_opts = req.GET.copy()
        search_opts.pop('limit', None)
        search_opts.pop('offset', None)

        #filter out invalid option
        allowed_search_options = ('status', 'volume_id', 'display_name')
        volumes.remove_invalid_options(context, search_opts,
                                       allowed_search_options)

        snapshots = self.volume_api.get_all_snapshots(context,
                                                      search_opts=search_opts)
        limited_list = common.limited(snapshots, req)
        res = [entity_maker(context, snapshot) for snapshot in limited_list]
        return {'snapshots': res}
Пример #4
0
    def _items(self, req, entity_maker):
        """Returns a list of snapshots, transformed through entity_maker."""
        context = req.environ['cinder.context']

        #pop out limit and offset , they are not search_opts
        search_opts = req.GET.copy()
        search_opts.pop('limit', None)
        search_opts.pop('offset', None)

        #filter out invalid option
        allowed_search_options = ('status', 'volume_id', 'display_name')
        volumes.remove_invalid_options(context, search_opts,
                                       allowed_search_options)

        snapshots = self.volume_api.get_all_snapshots(context,
                                                      search_opts=search_opts)
        limited_list = common.limited(snapshots, req)
        res = [entity_maker(context, snapshot) for snapshot in limited_list]
        return {'snapshots': res}