- Make sure we log when an exception occurs in the squashing code
- Have queue file always try to return any remaining data in the buffer - Remove the raise of the exception when we get an empty tar file
This commit is contained in:
parent
53349e313e
commit
a423032e80
3 changed files with 4 additions and 2 deletions
|
@ -49,6 +49,7 @@ def _write_synthetic_image_to_storage(linked_storage_uuid, linked_locations, que
|
||||||
store = Storage(app)
|
store = Storage(app)
|
||||||
|
|
||||||
def handle_exception(ex):
|
def handle_exception(ex):
|
||||||
|
logger.debug('Exception when building squashed image %s: %s', linked_storage_uuid, ex)
|
||||||
model.delete_derived_storage_by_uuid(linked_storage_uuid)
|
model.delete_derived_storage_by_uuid(linked_storage_uuid)
|
||||||
|
|
||||||
queue_file.add_exception_handler(handle_exception)
|
queue_file.add_exception_handler(handle_exception)
|
||||||
|
|
|
@ -20,7 +20,9 @@ class QueueFile(object):
|
||||||
|
|
||||||
def read(self, size=8192):
|
def read(self, size=8192):
|
||||||
if self._closed or self._done:
|
if self._closed or self._done:
|
||||||
return None
|
buf = self._buffer[0:size]
|
||||||
|
self._buffer = self._buffer[size:]
|
||||||
|
return buf
|
||||||
|
|
||||||
while len(self._buffer) < size:
|
while len(self._buffer) < size:
|
||||||
result = self._queue.get(block=True)
|
result = self._queue.get(block=True)
|
||||||
|
|
|
@ -13,7 +13,6 @@ class TarLayerFormat(object):
|
||||||
try:
|
try:
|
||||||
tar_file = tarfile.open(mode='r|*', fileobj=current_tar)
|
tar_file = tarfile.open(mode='r|*', fileobj=current_tar)
|
||||||
except tarfile.ReadError as re:
|
except tarfile.ReadError as re:
|
||||||
raise re
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# For each of the tar entries, yield them IF and ONLY IF we have not
|
# For each of the tar entries, yield them IF and ONLY IF we have not
|
||||||
|
|
Reference in a new issue