Comment 22 for bug 1703856

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

Reviewed: https://review.openstack.org/493654
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=bf7887a102ca33dd46ef24b67b07eb77154ce133
Submitter: Zuul
Branch: master

commit bf7887a102ca33dd46ef24b67b07eb77154ce133
Author: Matthew Treinish <email address hidden>
Date: Wed Aug 16 10:29:46 2017 -0400

    Replace body_file with class to call uwsgi.chunked_read()

    Since the WebOb 1.7 release webob doesn't natively support receiving
    chunked transfer encoding bodies. [1] When glance is run under the
    eventlet wsgi server this was fine, because eventlet will dechunk the
    input on read() (or readline()) calls, so from the webob perspective
    it's just a file object. However, the effort to remove the dependence
    on using eventlet as the web server and deploy glance as a traditional
    wsgi script we lose this mechanism. The wsgi spec doesn't provide a
    consistent mechanism

    When we run glance under uwsgi the uwsgi server provides an api to read
    chunked data. [2] However, we need to explicitly call that api when to
    dechunk the data and pass it to glance code which expects a file object.
    This commit solves this issue by creating a fake file class that will
    call the chunked_read() api from uwsgi on read() calls. This object is
    then used if we're running the api code under uwsgi and the body has a
    chunked transfer-encoding.

    In conjuction with devstack change
    Iab2e2848877fa1497008d18c05b0154892941589 this closes glance bug 1703856

    [1] https://docs.pylonsproject.org/projects/webob/en/stable/whatsnew-1.7.html#backwards-incompatibility
    [2] http://uwsgi-docs.readthedocs.io/en/latest/Chunked.html

    Partial-bug 1703856

    Co-Authored-By: Chris Dent <email address hidden>

    Change-Id: Idf6b4b891ba31cccbeb53d373b40fce5380cea64