ping=pong used as a v2 option to index.

Bug #1157988 reported by John Bresnahan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Mark Washenberger

Bug Description

In the test:

https://github.com/openstack/glance/blob/master/glance/tests/functional/v2/test_images.py#L487

The query parameters ping=pong are used in a call to /v2/images. I cannot find solid documentation for valid v2 options so I am not sure if they should be open ended where they allow everything.

Revision history for this message
Mark Washenberger (markwash) wrote :

I believe that filtering is supposed to accept arbitrary parameters, as image properties can take on arbitrary parameters.

Revision history for this message
John Bresnahan (jbresnah) wrote :

This makes it hard to deal with the is_public as mentioned in this bug: https://bugs.launchpad.net/glance/+bug/1154760

The following can happen in the current code base.

A user queries for an image using the v2 API and sets the filter is_public=foo. The logic here:

https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L583

causes this filter query to go against the models.Image member is_public, and not the properties. This causes some unexpected results. In v2 a user providing the is_public filter should be querying their own properties and not the state which is set by 'visibility' .

should we disallow the usage of the property with the name 'is_public' in order to avoid this confusion? Or should we allow the use of it an have some special case logic to handle is_public specifically (I think that is the only one).

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
assignee: nobody → John Bresnahan (jbresnah)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in glance:
assignee: John Bresnahan (jbresnah) → Mark Washenberger (markwash)
Changed in glance:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/25190
Committed: http://github.com/openstack/glance/commit/d8e3f873e01280d49602ce87bed4d1e08ff07640
Submitter: Jenkins
Branch: master

commit d8e3f873e01280d49602ce87bed4d1e08ff07640
Author: Mark J. Washenberger <email address hidden>
Date: Fri Mar 22 10:59:28 2013 -0700

    Make is_public an argument rather than a filter.

    There is disagreement between the v1 api and v2 api about what an
    'is_public' filter ought to mean. Version 1 uses 'is_public'
    to filter whether or not image.is_public == True or False. Version 2
    uses 'visibility' for this purpose. But in addition, it is theoretically
    possible that 'is_public' is a valid property filter in v2.

    With this change, v1 can pass is_public in as an argument to
    image_get_all. V2 will continue to pass is_public through filters.

    fixes bug: 1157988
    fixes bug: 1154760

    Change-Id: I716cb8b4f207f8526125ed360f5a24a6630c1e67

Changed in glance:
status: In Progress → Fix Committed
Changed in glance:
milestone: none → havana-1
Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: havana-1 → 2013.2
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.