~jaypipes/glance/bug759018

« back to all changes in this revision

Viewing changes to glance/registry/db/models.py

  • Committer: Tarmac
  • Author(s): jaypipes at gmail
  • Date: 2011-03-25 19:17:35 UTC
  • mfrom: (75.3.13 checksum)
  • Revision ID: tarmac-20110325191735-rk1wy065cloviubu
Adds checksumming to Glance.

When adding an image (or uploading an image during PUT operations),
you may now supply an optional X-Image-Meta-Checksum header. When
storing the uploaded image, the backend image stores now are required
to return a checksum of the data they just stored. The optional
X-Image-Meta-Checksum header is compared against this generated checksum
and returns a 409 Bad Request if there is a mismatch.

The ETag header is now properly set to the image's checksum now
for all GET /images/<ID>, HEAD /images/<ID>, POST /images and
PUT /images/<ID> operations.

Adds unit tests verifying the checksumming behaviour in the API, and
in the Swift and Filesystem backend stores.

Includes migration script.

NOTE: This does not include the DB migration script. Separate bug will be filed for that.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
    status = Column(String(30), nullable=False)
105
105
    is_public = Column(Boolean, nullable=False, default=False)
106
106
    location = Column(Text)
 
107
    checksum = Column(String(32))
107
108
 
108
109
 
109
110
class ImageProperty(BASE, ModelBase):