v2 API can't create image - Attribute 'file' is reserved.

Bug #1302351 reported by Sam Morrison
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Invalid
Undecided
Unassigned
Glance Client
Fix Released
Undecided
Unassigned

Bug Description

Trying to create an image with V2 API and get the following error:

glance --os-image-api-version 2 --os-image-url http://glance-icehouse:9292/ image-create --container-format bare --disk-format raw --name trusty2 --file trusty-server-cloudimg-amd64-disk1.img
Request returned failure status.
403 Forbidden
Attribute 'file' is reserved.
    (HTTP 403)

It works fine if I do --os-image-api-version 1

Sam Morrison (sorrison)
summary: - v2 API can't create image
+ v2 API can't create image - Attribute 'file' is reserved.
Revision history for this message
Tom Fifield (fifieldt) wrote :

Confirming under ubuntu 14.04 beta using rc-1 packages

glance --os-image-api-version 2 --os-image-url http://controller:9292/ image-create --container-format bare --disk-format raw --name trusty2 --file cirros-0.3.1-x86_64-disk.img
Request returned failure status.
403 Forbidden
Attribute 'file' is read-only.
    (HTTP 403)

debug log @ http://paste.openstack.org/show/75050/

 glance --os-image-api-version 1 --os-image-url http://controller:9292/ image-create --container-format bare --disk-format raw --name trusty2 --file cirros-0.3.1-x86_64-disk.img
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | d972013792949d0d3ba628fbe8685bce |
| container_format | bare |
| created_at | 2014-04-04T06:17:46 |
| deleted | False |
| deleted_at | None |
| disk_format | raw |
| id | 0d4590ec-c29f-4add-aca1-6333e016ae53 |
| is_public | False |
| min_disk | 0 |
| min_ram | 0 |
| name | trusty2 |
| owner | f703c3a1fb8d470b9078ad8598b2ed04 |
| protected | False |
| size | 13147648 |
| status | active |
| updated_at | 2014-04-04T06:17:47 |
| virtual_size | None |
+------------------+--------------------------------------+

Changed in glance:
status: New → Confirmed
tags: added: icehouse-rc-potential
Revision history for this message
Mark Washenberger (markwash) wrote :

I think this is actually a glanceclient bug.
In glance v2, the image creation and image data upload are two separate steps. The reason why this command is failing is because image-create is actually trying to create a property 'file' with value 'cirros-0.3.1-x86_64-disk.img'. It is not trying to read and upload the contents of that file.

Changed in python-glanceclient:
status: New → Confirmed
Changed in glance:
status: Confirmed → Invalid
Revision history for this message
Chris Buccella (chris-buccella) wrote :

Is this even a glanceclient bug? Diffing "glance help image-create" between v1 and v2 clearly shows a difference, with "--file" being described as READ-ONLY in v2. To be fair though, what "--file" is actually meant for the isn't all that clear.

Revision history for this message
Sam Morrison (sorrison) wrote :
Revision history for this message
Sam Morrison (sorrison) wrote :

I have confirmed this is a glanceclient bug, this command also does not work with a Havana glance server

wanghong (w-wanghong)
Changed in python-glanceclient:
assignee: nobody → wanghong (w-wanghong)
wanghong (w-wanghong)
Changed in python-glanceclient:
assignee: wanghong (w-wanghong) → nobody
Thierry Carrez (ttx)
tags: added: icehouse-backport-potential
removed: icehouse-rc-potential
Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

Seems to work ok now

$ glance --os-image-api-version 2 image-create --container-format bare --disk-format raw --name trusty2 --file /etc/fstab

+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 9cb02fe7fcac26f8a25d6db3109063ae |
| container_format | bare |
| created_at | 2015-08-27T16:45:40Z |
| disk_format | raw |
| id | b16dbfb2-f435-40a8-aa08-2aadaee99cd1 |
| min_disk | 0 |
| min_ram | 0 |
| name | trusty2 |
| owner | 411423405e10431fb9c47ac5b2446557 |
| protected | False |
| size | 145 |
| status | active |
| tags | [] |
| updated_at | 2015-08-27T16:45:40Z |
| virtual_size | None |
| visibility | private |
+------------------+--------------------------------------+

Changed in python-glanceclient:
status: Confirmed → Fix Released
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.