Content-Length not getting set in update operation

Bug #1045824 reported by Unmesh Gurjar on 2012-09-04
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Unmesh Gurjar

Bug Description

Branch: master (commitID: e233f66ecd0f30523226246bec1c2e62223344ec)

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.

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 Edit Tag help
Changed in python-glanceclient:
assignee: nobody → Unmesh Gurjar (unmesh-gurjar)

Fix proposed to branch: master

Changed in python-glanceclient:
status: New → In Progress

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

    Fixes LP: #1045824

    Change-Id: If259fc5a338e3e90214a52b773132ed901691c0f

Changed in python-glanceclient:
status: In Progress → Fix Committed
Brian Waldon (bcwaldon) on 2012-09-10
Changed in python-glanceclient:
importance: Undecided → High
Brian Waldon (bcwaldon) on 2012-09-11
Changed in python-glanceclient:
milestone: none → v0.5
Brian Waldon (bcwaldon) on 2012-09-11
Changed in python-glanceclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers