x-image-meta-size in POST /images not optional, contrary to documentation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
Fix Released
|
Critical
|
Jay Pipes |
Bug Description
When performing this request against glance-api:
POST /images HTTP/1.0
x-image-meta-name: test
x-image-meta-type: raw
x-image-
I get an exception in glance-registry:
File "/usr/lib/
image_data = db.image_
File "/usr/lib/
return IMPL.image_
File "/usr/lib/
return _image_
File "/usr/lib/
values['size'] = int(values['size'])
KeyError: 'size'
As far as I can see, no attempt has been made to validate the request in glance.
I'm not sure how to fix this, because I don't know what the API definition is intended to be, other than the fact that x-image-meta-size is defined as optional in the Glance API. The options I see are:
1. Define glance-api be the one to correctly determine the image size if it's missing, and therefore glance-registry may require that the size field is present in the request (and should validate it as such before passing it to the DB layer).
2. Define glance-registry's API such that size is optional, and set the field to None or -1 or something like that, when saving the record in the database.
3 Make x-image-meta-size compulsory.
Related branches
- Rick Harris (community): Approve
- Devin Carlen (community): Approve
- Ewan Mellor: Pending requested
-
Diff: 1161 lines (+507/-278)11 files modifieddoc/source/client.rst (+100/-97)
doc/source/glanceapi.rst (+149/-137)
doc/source/index.rst (+1/-0)
doc/source/statuses.rst (+48/-0)
glance/server.py (+61/-3)
glance/store/__init__.py (+2/-4)
glance/store/filesystem.py (+6/-2)
run_tests.py (+67/-0)
run_tests.sh (+42/-32)
tests/stubs.py (+1/-0)
tests/unit/test_clients.py (+30/-3)
Changed in glance: | |
assignee: | nobody → Jay Pipes (jaypipes) |
status: | Confirmed → In Progress |
Changed in glance: | |
status: | In Progress → Fix Committed |
Changed in glance: | |
milestone: | none → 0.1.7 |
status: | Fix Committed → Fix Released |
Hi Ewan,
The intent was to make the field optional. It's a bug that the layer *above* the db API is not determining the image size when not present.
Cheers,
jay