Glance create API times out with copy_from header

Bug #1008874 reported by Gabriel Hurley
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Eoghan Glynn

Bug Description

The code in the create method goes through two discrete stages, the _reserve stage that creates the record, and the _handle_source stage that adds the image data to the store. When doing a copy-from operation, this can involve a very lengthy download which ties up the response causing socket timeouts, etc. for the API, especially when used from Horizon.

There's no reason that download can't happen asynchronously. Simply let the _handle_source method happen in its own thread and return a 202 Accepted from the API there.

The relevant bit to be spun off are the lines here: https://github.com/openstack/glance/blob/stable/essex/glance/api/v1/images.py#L544

Brian Waldon (bcwaldon)
Changed in glance:
status: New → Triaged
importance: Undecided → Medium
milestone: none → folsom-3
Eoghan Glynn (eglynn)
Changed in glance:
assignee: nobody → Eoghan Glynn (eglynn)
Brian Waldon (bcwaldon)
Changed in glance:
milestone: folsom-3 → none
Brian Waldon (bcwaldon)
Changed in glance:
milestone: none → folsom-rc1
Eoghan Glynn (eglynn)
Changed in glance:
status: Triaged → In Progress
Revision history for this message
Eoghan Glynn (eglynn) wrote :

The fix will involve an asynchronous copy-from, but not a 202 Accepted status code as suggested, since such a change to a non-error response would require a API version bump, see:

   http://wiki.openstack.org/APIChangeGuidelines

The status code from the image creation will continue to be 201 Created in all cases, with the initial image status reported as queued while the asynchronous copy-from is in progress.

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/12438

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/12438
Committed: http://github.com/openstack/glance/commit/41c164139cab619d0a3e0d97b80037f85eb541ad
Submitter: Jenkins
Branch: master

commit 41c164139cab619d0a3e0d97b80037f85eb541ad
Author: Eoghan Glynn <email address hidden>
Date: Wed Sep 5 14:33:47 2012 +0000

    Asynchronously copy from external image source

    Fixes bug 1008874, bug 1046433.

    Avoid tieing up dispatch thread for large copy-from images,
    instead initiate copy asynchronously.

    The response status is not set to 202 Accepted as per standard
    RESTful idiom, as a non-error response code change requires
    an API version bump.

    Instead, the incomplete nature of the image registration is
    reflected in the image status.

    Change-Id: I06692422490de0a7d93f63bbd0ffb9c6435a0d2b

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: folsom-rc1 → 2012.2
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.