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.
Reviewed: https:/ /review. openstack. org/2072 github. com/openstack/ glance/ commit/ 98b1ef337ee63f2 39829b44aec4d05 cea99f98ad
Committed: http://
Submitter: Jenkins
Branch: master
status fixcommitted
done
commit 98b1ef337ee63f2 39829b44aec4d05 cea99f98ad
Author: Paul Bourke <email address hidden>
Date: Mon Dec 5 15:56:18 2011 +0000
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 chunk_size until we reach EOL(None). chunk_size bytes
stream, simply read large_object_
This works even when there is less than large_object_
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 tests.unit. test_swift_ store:TestStore .
glance.
This unit test demonstrates the bug and will test for regressions. It large_object but specifies an image_size of 0 to
mirrors test_add_
excercise the new code path.
Change-Id: Ic8b78be5dce228 1c80372ed446499 f6d0bc07f40