Zun

Expose container filters via API

Bug #1750208 reported by hongbin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zun
Fix Released
Medium
Deepak Mourya

Bug Description

Description
===========
Right now, in DB layer, we support to filter containers with certain attributes. In particular, we support filter containers by attributes such as name, image, project_id, status, etc. [1]. It is better to expose this filter via REST API level. For example:

  GET /v1/containers?project_id=<my_project_id>

This should return a list of containers in particular project.

Implementation
==============
At zun/api/controllers/v1/containers.py , method 'get_all', populate the 'filters' from query parameter provided by users. For example (UNTESTED),

        filters = {}
        for filter_key in container_allowed_filters:
            if filter_key in kwargs:
                filter_value = kwargs[filter_key]
                filters[filter_key] = filter_value
        ...
        containers = objects.Container.list(context,
                                            limit,
                                            marker_obj,
                                            sort_key,
                                            sort_dir,
                                            filters=filters)

Reference
=========
[1] https://github.com/openstack/zun/blob/master/zun/db/sqlalchemy/api.py#L132

hongbin (hongbin034)
description: updated
Changed in zun:
status: New → Triaged
importance: Undecided → Medium
Changed in zun:
assignee: nobody → Deepak Mourya (mourya007)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to zun (master)

Fix proposed to branch: master
Review: https://review.openstack.org/546098

Changed in zun:
status: Triaged → In Progress
hongbin (hongbin034)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to zun (master)

Reviewed: https://review.openstack.org/546098
Committed: https://git.openstack.org/cgit/openstack/zun/commit/?id=00916cfdffe8d10ab6767a2a398743e477b6ea07
Submitter: Zuul
Branch: master

commit 00916cfdffe8d10ab6767a2a398743e477b6ea07
Author: deepak_mourya <email address hidden>
Date: Tue Feb 20 15:32:28 2018 +0530

    Expose container filters via API

    Right now, in DB layer, we support to filter containers
    with certain attributes. In particular, we support
    filter containers by attributes such as name, image,
    project_id, status, etc. [1]. It is better to expose this
    filter via REST API level. For example:

      GET /v1/containers?project_id=<my_project_id>

    This should return a list of containers in particular project.

    [1] https://github.com/openstack/zun/blob/master/zun/db/sqlalchemy/api.py#L132

    Change-Id: I599a9f48a966d564da718b97bdad7cfac6ae4dfe
    Closes-Bug: #1750208

Changed in zun:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/zun 2.0.0

This issue was fixed in the openstack/zun 2.0.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.