예제 #1
0
    def show(self, req, id):
        ctxt = req.environ['delfin.context']
        query_params = {"storage_id": id}
        query_params.update(req.GET)
        # Update options  other than filters
        sort_keys, sort_dirs = api_utils.get_sort_params(query_params)
        marker, limit, offset = api_utils.get_pagination_params(query_params)
        # Strip out options except supported search  options
        api_utils.remove_invalid_options(
            ctxt, query_params, self._get_volume_group_search_options())

        volume_groups = db.volume_groups_get_all(ctxt, marker, limit,
                                                 sort_keys, sort_dirs,
                                                 query_params, offset)

        # Get Volume Group to Volume relation from DB
        for volume_group in volume_groups:
            params = {
                "native_volume_group_id":
                volume_group['native_volume_group_id']
            }
            volumes = db.vol_grp_vol_rels_get_all(ctxt, filters=params)

            native_volume_id_list = []
            for volume in volumes:
                native_volume_id_list.append(volume['native_volume_id'])

            volume_group['volumes'] = native_volume_id_list

        return volume_group_view.build_volume_groups(volume_groups)
예제 #2
0
    def show(self, req, id):
        ctxt = req.environ['delfin.context']
        query_params = {"storage_id": id}
        query_params.update(req.GET)
        # Update options  other than filters
        sort_keys, sort_dirs = api_utils.get_sort_params(query_params)
        marker, limit, offset = api_utils.get_pagination_params(query_params)
        # Strip out options except supported search  options
        api_utils.remove_invalid_options(
            ctxt, query_params, self._get_storage_host_group_search_options())

        storage_host_groups = db.storage_host_groups_get_all(
            ctxt, marker, limit, sort_keys, sort_dirs, query_params, offset)

        # Get Storage Host Group to Host relation from DB
        for host_group in storage_host_groups:
            params = {
                "native_storage_host_group_id":
                host_group['native_storage_host_group_id']
            }
            hosts = db.storage_host_grp_host_rels_get_all(ctxt, filters=params)

            native_storage_host_id_list = []
            for host in hosts:
                native_storage_host_id_list.append(
                    host['native_storage_host_id'])

            host_group['storage_hosts'] = native_storage_host_id_list

        return storage_host_group_view\
            .build_storage_host_groups(storage_host_groups)
예제 #3
0
파일: storages.py 프로젝트: joseph-v/delfin
    def index(self, req):
        ctxt = req.environ['delfin.context']
        query_params = {}
        query_params.update(req.GET)
        # update options  other than filters
        sort_keys, sort_dirs = api_utils.get_sort_params(query_params)
        marker, limit, offset = api_utils.get_pagination_params(query_params)
        # strip out options except supported search  options
        api_utils.remove_invalid_options(ctxt, query_params,
                                         self._get_storages_search_options())

        storages = db.storage_get_all(ctxt, marker, limit, sort_keys,
                                      sort_dirs, query_params, offset)
        return storage_view.build_storages(storages)
예제 #4
0
    def show(self, req, id):
        ctxt = req.environ['delfin.context']
        query_params = {"storage_id": id}
        query_params.update(req.GET)
        # Update options  other than filters
        sort_keys, sort_dirs = api_utils.get_sort_params(query_params)
        marker, limit, offset = api_utils.get_pagination_params(query_params)
        # Strip out options except supported search  options
        api_utils.remove_invalid_options(
            ctxt, query_params, self._get_masking_view_search_options())

        masking_view_lists = db.masking_views_get_all(ctxt, marker, limit,
                                                      sort_keys, sort_dirs,
                                                      query_params, offset)
        return masking_views.build_masking_views(masking_view_lists)
예제 #5
0
    def show(self, req, id):
        ctxt = req.environ['delfin.context']
        query_params = {"storage_id": id}
        query_params.update(req.GET)
        # Update options  other than filters
        sort_keys, sort_dirs = api_utils.get_sort_params(query_params)
        marker, limit, offset = api_utils.get_pagination_params(query_params)
        # Strip out options except supported search  options
        api_utils.remove_invalid_options(
            ctxt, query_params, self._get_storage_host_search_options())

        storage_hosts = db.storage_hosts_get_all(ctxt, marker, limit,
                                                 sort_keys, sort_dirs,
                                                 query_params, offset)
        for storage_host in storage_hosts:
            storage_host['storage_host_initiators'] \
                = self._fill_storage_host_initiators(ctxt, storage_host, id)

        return storage_host_view.build_storage_hosts(storage_hosts)