Content-Length not getting set in update operation

Bug #1045824 reported by Unmesh Gurjar
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
High
Unmesh Gurjar

Bug Description

Branch: master (commitID: e233f66ecd0f30523226246bec1c2e62223344ec)

Scenario:
1. Using the Python glanceclient, create a blank image (no body specified).
2. Then call the image update method (from Python glanceclient), providing it the open file handle of a volume (eg. in my case a Cinder volume local path is like: '/dev/mapper/stack--volumes-volume--7441a650--9a33--4bfa--8411--4256b77a1648' and I provide the handle to this file opened in "r" mode).

Actual Result:
Glance (ImageDeserializer) ignores the data (since Content-Length is Not Available) and the update call returns an error.

Expected Result:
Glance should read the image data and update the metadata as well.

Observations:
On providing an open file handle of a non-volume (eg. image file), the Content-Length header gets set (automatically from httplib.HTTPConnection request method) and the 'update' works fine. I have come across this issue only on trying to upload a volume to an image.

Tags: ntt
Changed in python-glanceclient:
assignee: nobody → Unmesh Gurjar (unmesh-gurjar)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/12491

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

Reviewed: https://review.openstack.org/12491
Committed: http://github.com/openstack/python-glanceclient/commit/30d8e1b97ce0621a0ce9aae97ad8ab35101860e6
Submitter: Jenkins
Branch: master

commit 30d8e1b97ce0621a0ce9aae97ad8ab35101860e6
Author: Unmesh Gurjar <email address hidden>
Date: Thu Sep 6 00:36:38 2012 -0700

    Specified Content-Length in update request header

    While uploading a Volume to an image, the HTTPConnection's request method does
    not set the Content-Length header (since the volume file is a sym link i.e. the
    os.fstat call returns a st_size of 0). This causes Volume uploads to Glance
    fail (since the image data is ignored as no content-length is specified).
    Therefore setting the Content-Length from update( ) method if the image data is
    provided.

    Fixes LP: #1045824

    Change-Id: If259fc5a338e3e90214a52b773132ed901691c0f

Changed in python-glanceclient:
status: In Progress → Fix Committed
Brian Waldon (bcwaldon)
Changed in python-glanceclient:
importance: Undecided → High
Brian Waldon (bcwaldon)
Changed in python-glanceclient:
milestone: none → v0.5
Brian Waldon (bcwaldon)
Changed in python-glanceclient:
status: Fix Committed → 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.