glance add uploads a double image if using ssl and images is smaller the 4k

Bug #1007093 reported by Derek Higgins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
High
Derek Higgins
Essex
Fix Released
High
Eoghan Glynn
glance (Ubuntu)
Fix Released
Undecided
Unassigned
Precise
Fix Released
Undecided
Unassigned
Quantal
Fix Released
Undecided
Unassigned

Bug Description

If using https and
   adding a image smaller then 4096 bytes and
   adding a seekable file then
      glance add uploads the correct contents twice both concatenated together.

# ls -l testfile
-rw-r--r--. 1 root root 12 May 31 12:09 testfile

# glance -k -v --silent-upload add name="aki-tty" type="kernel" disk_format="aki" container_format="aki" is_public=true < testfile
Added new image with ID: f0278cf2-83db-473c-bb52-e5cc4fcc4783
Returned the following metadata for the new image:
<snip/>
                           size => 24
<snip/>
Completed in 0.8296 sec.

This bug manifests itself as a progress/status animation that never ends (so I've used --silent-upload in the command above)

Related branches

Derek Higgins (derekh)
Changed in glance:
assignee: nobody → Derek Higgins (derekh)
Revision history for this message
Derek Higgins (derekh) wrote :

it looks like its bad to use a mixture of
file.seek and os.lseek

[derekh@laptop tmp]$ cat t.py
import os

body = open("testfile")

body.seek(0, os.SEEK_END)
body.seek(0)
os.lseek(body.fileno(), 0, os.SEEK_SET)

print body.read()

[derekh@laptop tmp]$ cat testfile
Hello World
[derekh@laptop tmp]$ python t.py
Hello World
Hello World

this sequence happens in the glance client on the stdin file object in
glance/client.py - _get_image_size
and
glance/common/client.py _seekable

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

Changed in glance:
status: New → In Progress
Brian Waldon (bcwaldon)
Changed in glance:
importance: Undecided → High
milestone: none → folsom-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/8005
Committed: http://github.com/openstack/glance/commit/a25824e77ae86da840493ee8fbf5dc68a27dd74b
Submitter: Jenkins
Branch: master

commit a25824e77ae86da840493ee8fbf5dc68a27dd74b
Author: Derek Higgins <email address hidden>
Date: Thu May 31 22:13:40 2012 +0100

    fix side effects from seekability test on input file

    Fixes Bug #1007093

    Mixing use of os.lseek(fileno, 0, os.SEEK_SET) with
    file.seek seems to cause problems when reading data
    with file.read

    Change-Id: Ia96ce9bbdc93a1a8c6169d85b99187f8cd7b2fdc

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/essex)

Fix proposed to branch: stable/essex
Review: https://review.openstack.org/8599

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

Reviewed: https://review.openstack.org/8599
Committed: http://github.com/openstack/glance/commit/37c9a7e2a1ea9c0a1f4e9d5585a4ada465310898
Submitter: Jenkins
Branch: stable/essex

commit 37c9a7e2a1ea9c0a1f4e9d5585a4ada465310898
Author: Derek Higgins <email address hidden>
Date: Thu May 31 22:13:40 2012 +0100

    fix side effects from seekability test on input file

    Fixes Bug #1007093

    Mixing use of os.lseek(fileno, 0, os.SEEK_SET) with
    file.seek seems to cause problems when reading data
    with file.read

    Change-Id: Ia96ce9bbdc93a1a8c6169d85b99187f8cd7b2fdc

Thierry Carrez (ttx)
Changed in glance:
status: Fix Committed → Fix Released
Chuck Short (zulcss)
Changed in nova (Ubuntu Quantal):
status: New → Fix Released
no longer affects: nova (Ubuntu)
no longer affects: nova (Ubuntu Precise)
no longer affects: nova (Ubuntu Quantal)
Dave Walker (davewalker)
Changed in glance (Ubuntu):
status: New → Fix Released
Changed in glance (Ubuntu Precise):
status: New → Confirmed
Revision history for this message
Adam Gandelman (gandelman-a) wrote : Verification report.

Please find the attached test log from the Ubuntu Server Team's CI infrastructure. As part of the verification process for this bug, Glance has been deployed and configured across multiple nodes using precise-proposed as an installation source. After successful bring-up and configuration of the cluster, a number of exercises and smoke tests have be invoked to ensure the updated package did not introduce any regressions. A number of test iterations were carried out to catch any possible transient errors.

Please Note the list of installed packages at the top and bottom of the report.

For records of upstream test coverage of this update, please see the Jenkins links in the comments of the relevant upstream code-review(s):

Trunk review: https://review.openstack.org/8005
Stable review: https://review.openstack.org/8599

As per the provisional Micro Release Exception granted to this package by the Technical Board, we hope this contributes toward verification of this update.

Revision history for this message
Adam Gandelman (gandelman-a) wrote :

Test coverage log.

tags: added: verification-done
Revision history for this message
Clint Byrum (clint-fewbar) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package glance - 2012.1.3+stable~20120821-120fcf-0ubuntu1

---------------
glance (2012.1.3+stable~20120821-120fcf-0ubuntu1) precise-proposed; urgency=low

  * New upstream snapshot. (LP: #1041120)
  * Resynchronzie with stable/essex:
    - Glance add uploads a double image if using ssl and images is smaller
      than 4k. (LP: #1007093)
    - If response.environ is None, instance fails to spawn.
      (LP: #1010560)
    - exception.BadStoreURL exposes sensitive information to end users.
      (LP: #1012268)
    - glance-cache.conf needs metadata encryption key (LP: #1012752)
    - image.upload notification doesn't report size (LP: #1018246)
    - Admins should be able to share image regardless of ownership.
      (LP: #1021054)
    - Glance scrubber date formatting fails with postgres (LP: #1022369)
    - Support zero-size image creation. (LP: #1025353)
    - Image id not contained in swift chunk debug message. (LP: #1028433)
    - qpid_heartbeat setting is ineffective. (LP: #1032314)
    - Image properties that reference image ids are not updated to UUIDs.
      (LP: #975651)
    - Migration 012_id_to_uuid attempts to convert IDs twice for non-sqlite
      databases. (LP: #975655)
    - multiprocess glance-api failed to exit when stopped by ctrl+c.
      (LP: #978130)
    - /usr/bin/glance's built-in pager breaks redirection.
      (LP: #978610)
    - Content-Length and Transfer-Encoding are mutually exclusive HTTP headers
      (LP: #981332)
    - glance add command - incorrect help text (LP: #997565)
  * debian/patches/convert_properties_to_uuid.patch: Dropped no longer
    needed.
  * debian/patches/fix-pep8-ubuntu.patch: Dropped no longer needed.
 -- Adam Gandelman <email address hidden> Fri, 24 Jun 2012 03:14:33 -0400

Changed in glance (Ubuntu Precise):
status: Confirmed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: folsom-2 → 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.