Creating an image without container format queues image and fails with 400

Bug #1268680 reported by Jon Bernard
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Mike Fedosin

Bug Description

Description of problem:

Creating an image from CLI without --container format queued the image and fails with 400.

Request returned failure status.
400 Bad Request
Invalid container format 'None' for image.
    (HTTP 400)

How reproducible:
# glance --debug image-create --name cirros --disk-format qcow2 --file /tmp/cirros-image.qcow2 --progress
<snip>
[=============================>] 100%

HTTP/1.1 400 Bad Request
date: Tue, 07 Jan 2014 14:13:54 GMT
content-length: 64
content-type: text/plain; charset=UTF-8
x-openstack-request-id: req-11b4ecad-3a8d-4e44-9c37-a4d843805889

400 Bad Request

Invalid container format 'None' for image.

# glance image-list
+-----------------------------------------------------------+-----------+-----------------+------------------------+----------------+-----------+
| ID | Name | Disk Format | Container Format | Size | Status |
+-----------------------------------------------------------+-----------+-----------------+------------------------+----------------+-----------+
| b2490dd2-b535-4b98-8647-cca428a63e01 | cirros | qcow2 | | 307962880 | queued |
+-----------------------------------------------------------+-----------+-----------------+------------------------+----------------+-----------+

Jon Bernard (jbernard)
Changed in glance:
assignee: nobody → Jon Bernard (jbernard)
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/66386

Changed in glance:
status: New → In Progress
Revision history for this message
Erno Kuvaja (jokke) wrote :

iirc this is fixed

tags: added: propose-close
Changed in glance:
assignee: Jon Bernard (jbernard) → nobody
status: In Progress → New
Changed in glance:
assignee: nobody → Pranali Deore (pranali-deore)
Revision history for this message
Pranali Deore (pranali-deore) wrote :

This bug is reproducible in V2 api also.

Steps to reproduce:

 $glance --os-image-api-version 2 image-create --name Test --disk-format qcow2

 $glance --os-image-api-version 2 image-upload 21c74416-9fea-4160-98c0-867f82aa58e9 --file /home/openstack/aaaaa.py

As per discussion in glance weekly meeting, no fix is required for V1 api as V1 api will be deprecated during Kilo release, still we need to fix this bug for V2 api.

Please suggest.

Revision history for this message
Jon Bernard (jbernard) wrote :

Ok, I'll update my patch to target v2.

Revision history for this message
Jon Bernard (jbernard) wrote :

@pranali-deore Ah, i missed that you assigned to yourself, if you'd like to do the work that's fine with me - just let me know.

Revision history for this message
Pranali Deore (pranali-deore) wrote :

Difference between v1 and v2 api for this issue is,

For V1 :
If container format is not provided and disk-format is one of amazon format(ami, ari, aki), then image gets created with container-format = disk-format, else image goes into 'queued' state.

For V2 :
If container format or disk format is not provided then glance api raises appropriate error at the time of uploading image,

Steps:
 $glance --os-image-api-version 2 image-create --name Test

 $glance --os-image-api-version 2 image-update d43b2c0c-327e-4cab-9943-bbc093381fca --disk-format ami

 $glance --os-image-api-version 2 image-upload d43b2c0c-327e-4cab-9943-bbc093381fca --file /home/openstack/aaaaa.py

Then it raises 400 HTTPBadRequest with below error log,

"Cannot save data for image d43b2c0c-327e-4cab-9943-bbc093381fca:
Property container_format must be set prior to saving data. upload /opt/stack/glance/glance/api/v2/image_data.py:94"

IMO this is correct behaviour for V2.

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

Change abandoned by Jon Bernard (<email address hidden>) on branch: master
Review: https://review.openstack.org/66386

Ian Cordasco (icordasc)
Changed in glance:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Jun Hong Li (junhongl) wrote :

Yes, I've verified the steps Pranali said in comment #6, i agree that the existing v2 behavior is what the bug reporter expected when creating this bug. So I suggest we can close this bug.

Ian Cordasco (icordasc)
Changed in glance:
status: Confirmed → Invalid
assignee: Pranali Deore (pranali-deore) → nobody
Mike Fedosin (mfedosin)
Changed in glance:
assignee: nobody → Mike Fedosin (mfedosin)
status: Invalid → Confirmed
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/181130

Changed in glance:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/181130
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=ac9f373cd0402f90eee30a6f3944dfa10f948216
Submitter: Jenkins
Branch: master

commit ac9f373cd0402f90eee30a6f3944dfa10f948216
Author: Mike Fedosin <email address hidden>
Date: Thu May 7 22:05:42 2015 +0300

    Fix delayed activation without disk and containers formats

    If we want to perform a delayed activation of an image without
    providing disk format or container format, Glance tries to
    upload a file and fails with 400 error.

    This code handles this situation by checking that no sources
    were provided, and returns information about the image before
    starting the upload.

    Change-Id: Id6f81df9bb43697b0d694528b010bb3c7c9bedb3
    Closes-Bug: #1268680

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