filter on image name should not use exact name

Bug #1369008 reported by Gloria Gu
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Won't Fix
Low
Wlodzimierz Borkowski

Bug Description

Horizon passes name filter into glanceclient is like name=cirros. cirros is the partial name of the cirros-0.3.2-x86_64-uec-kernel image. glance should use the partial name to do search instead of using it as exact name matching.

The original bug reported in horizon like the following...after more digging, I moved the bug into glanceclient.

"at Admin-> Images

The filter on Image Name has to be exact the same as the image name. If I have the image names like the followings, it could be hard and not user friendly:

Fedora-x86_64-20-20140618-sda
cirros-0.3.2-x86_64-uec-kernel

Think the image name filter should do the same way as instances table's instance name filter which uses contains, not the exact match."

Gloria Gu (gloria-gu)
Changed in horizon:
assignee: nobody → Gloria Gu (gloria-gu)
Revision history for this message
Gloria Gu (gloria-gu) wrote :

I think this is more of glanceclient issue than horizon issue. Need more dig.

in glanceclient v1/images.py

def list(self, **kwargs):
.....

  filters = kwargs.get('filters', {})
        properties = filters.pop('properties', {})
        for key, value in properties.items():
            params['property-%s' % key] = value
        params.update(filters) -- line 241

here filters has name=cirros

line 195
url = '/v1/images/detail?%s' % urlparse.urlencode(qp)
   images, resp = self._list(url, "images")

'/v1/images/detail?sort_key=created_at&sort_dir=desc&limit=21&name=cirros&is_public=None'

Revision history for this message
Gloria Gu (gloria-gu) wrote :

tried with glanceclient v2...it seems to be worse...the admin->image table shows no rows at all even without filter...:(.

Revision history for this message
Cindy Lu (clu-m) wrote :

Hi Gloria,

Agreed, filtering on image exact name is a glanceclient issue (http://docs.openstack.org/developer/glance/glanceapi.html#filtering-images-lists) and definitely not as helpful. It's unfortunate that it doesn't use contains. :( It would be nice if we had some type of "OpenStack Projects Filtering Best Practices" so that all projects had same standards.

Gloria Gu (gloria-gu)
affects: horizon → python-glanceclient
Gloria Gu (gloria-gu)
description: updated
Changed in python-glanceclient:
assignee: Gloria Gu (gloria-gu) → nobody
no longer affects: horizon
Changed in python-glanceclient:
assignee: nobody → Wlodzimierz Borkowski (woodbor)
Revision history for this message
Wlodzimierz Borkowski (borqosky) wrote :

Glanceclient pass the name of the image to GET method, so I'm not sure that is possible to filter it on the client site.
After more digging, I think that the right place to filter it, is in glance glance/registry/client/v1/client.py and send back to the client.
So it affects Glance project directly

affects: python-glanceclient → glance
Revision history for this message
Feilong Wang (flwang) wrote :

I think it's reasonable to support the fuzzy query for image name. Looking forward to reviewing the code.

Changed in glance:
status: New → Triaged
importance: Undecided → Low
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/125780

Changed in glance:
status: Triaged → In Progress
Revision history for this message
Wlodzimierz Borkowski (borqosky) wrote :

Hi Fei, I didn't know about get rid of v1, and embrace v2 (still newbie in glance :).
So it seems to be simplest is to move this part to BaseClient(but method is related with filter images, and I think it doesn't fit there).
Another place is utils module in common, which can be reference from images in each v1/2
Thx for feedback

Revision history for this message
Randy Bertram (rbertram) wrote :

The partial match should also be non-case-sensitive. For example, "testi" should find "TestImage"

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on glance (master)

Change abandoned by Flavio Percoco (<email address hidden>) on branch: master
Review: https://review.openstack.org/125780
Reason: after all this time, I'd assume we don't need this patch anymore. The bug/blueprint was probably fixed already or invalidated. Please, feel free to re-open it if you think otherwise.

Revision history for this message
Cyril Roelandt (cyril-roelandt) wrote :

The change has been abandoned six years ago, and would probably require a (lite-)spec. I'm closing this, feel free to reopen if you believe this should be revisited.

Changed in glance:
status: In Progress → Won't Fix
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.