glance/glance
Paul Bourke 98b1ef337e Secondary iteration of fix for bug 891738
A problem exists that images larger than large_object_size without a
known image_size will fail to be segmented and hence fail to be added
to swift.

This patch alters the chunking process slightly:

- Instead of reading min(large_object_chunk_size, bytes_left) from the
  stream, simply read large_object_chunk_size until we reach EOL(None).
  This works even when there is less than large_object_chunk_size bytes
  amount available.

- The image_size can be determined from the combined length of each
  chunk read. If we are passed an unknown image_size this value can be
  used for the registry.

Test Changes:

- Fixed bug in fake_put_object which was highlighted by Jay when
  reviewing this changeset.
  The put of the manifest object needed to be moved inside the
  check for previous existence of a key.

- Added test_add_large_object_zero_size to
  glance.tests.unit.test_swift_store:TestStore.

  This unit test demonstrates the bug and will test for regressions. It
  mirrors test_add_large_object but specifies an image_size of 0 to
  excercise the new code path.

Change-Id: Ic8b78be5dce2281c80372ed446499f6d0bc07f40
2011-12-06 17:55:15 +00:00
..
api Fixes LP Bug#861650 - Glance client deps 2011-11-30 09:41:22 -05:00
common Fixes LP Bug#861650 - Glance client deps 2011-11-30 09:41:22 -05:00
image_cache Merge "Check to make sure the incomplete file exists before moving it during rollback. Fixes bug #888241." 2011-11-23 17:41:21 +00:00
registry Casting foreign_keys to a list in order to index into it. 2011-11-11 00:51:58 +00:00
store Secondary iteration of fix for bug 891738 2011-12-06 17:55:15 +00:00
tests Secondary iteration of fix for bug 891738 2011-12-06 17:55:15 +00:00
__init__.py load gettext in __init__ to fix '_ is not defined' 2011-11-08 10:58:25 -08:00
client.py Fixes LP Bug#861650 - Glance client deps 2011-11-30 09:41:22 -05:00
version.py Open Essex 2011-09-08 20:49:28 +02:00