images filtering with Glance image services and PostgreSQL
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Medium
|
Brian Waldon |
Bug Description
I have a Nova installation that's configured to use Glance as image service. Glance is configured to use PostgreSQL as a database.
Image listing in Nova doesn't return any images if I filter by status in upper case. Example:
curl -i http://
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 14
Date: Wed, 29 Feb 2012 13:26:21 GMT
{"images": []}
However,
curl -i http://
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1320
Date: Wed, 29 Feb 2012 13:27:30 GMT
{"images": [{"id": "23e2fb2d-
The reason is that PostgreSQL is case sensitive. Glance stores images' statuses in lower case, so filtering by status in upper case doesn't show any result. And nova passes filters as is, the request above doesn't show relevant results. This is not quite right as some API consumers doesn't care much about case of the status.
The problem could be easily reproduced by glance only:
root@host:~# glance -A nova index status=ACTIVE|wc -l
0
root@host:~# glance -A nova index status=active|wc -l
5
root@host:~#
According to the documentation, nova uses uppercase statuses in filters: "In-flight images will have the status attribute set to SAVING and the conditional progress element (0-100% completion) will also be returned. Other possible values for the status attribute include: UNKNOWN, ACTIVE, SAVING, ERROR, and DELETED. " (c) http://
And Glance expects statuses to be lowercase: http://
So appears that the right think would be to convert statuses to lowercase before passing them to Glance.
Attached a patch which fixes the problem for me.
Changed in nova: | |
assignee: | nobody → Brian Waldon (bcwaldon) |
importance: | Undecided → Medium |
status: | New → In Progress |
Changed in nova: | |
milestone: | none → essex-rc1 |
Changed in nova: | |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | essex-rc1 → 2012.1 |
Fix proposed to branch: master /review. openstack. org/4775
Review: https:/